forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrw_placeholder_navigation_info.h
46 lines (34 loc) · 1.73 KB
/
crw_placeholder_navigation_info.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_WEB_NAVIGATION_CRW_PLACEHOLDER_NAVIGATION_INFO_H_
#define IOS_WEB_NAVIGATION_CRW_PLACEHOLDER_NAVIGATION_INFO_H_
#import <WebKit/WebKit.h>
#import "base/ios/block_types.h"
NS_ASSUME_NONNULL_BEGIN
// An NSObject wrapper for a completion handler for a placeholder navigation.
//
// A placeholder navigation is an "about:blank" page loaded into the WKWebView
// that corresponds to Native View or WebUI URL. This navigation is inserted to
// generate a WKBackForwardListItem for the Native View or WebUI URL in the
// WebView so that the WKBackForwardList contains the full list of user-visible
// navigations.
//
// Because loading in WKWebView is asynchronous, this object is attached to the
// WKNavigation for the placeholder hold, and the completion handler is expected
// to be executed in WKNavigationDelegate's |didFinishNavigation| callback to
// trigger the NativeView or WebUI HTML load.
@interface CRWPlaceholderNavigationInfo : NSObject
// Create a new instance that encapsulates a completion handler to be executed
// when |navigation| is finished.
+ (instancetype)createForNavigation:(WKNavigation*)navigation
withCompletionHandler:(ProceduralBlock)completionHandler;
// Returns the CRWPlaceholderNavigationInfo associated with |navigation|.
+ (nullable CRWPlaceholderNavigationInfo*)infoForNavigation:
(nullable WKNavigation*)navigation;
// Runs the completion handler saved in this object.
- (void)runCompletionHandler;
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
#endif // IOS_WEB_NAVIGATION_CRW_PLACEHOLDER_NAVIGATION_INFO_H_