Commit 8fd48e6a authored by Yi Su's avatar Yi Su Committed by Commit Bot

Move decidePolicyForNavigationAction into CRWWKNavigationHandler.

This CL moves WKNavigationDelegate method
"webView:decidePolicyForNavigationAction:decisionHandler" from
CRWWebController into CRWWKNavigationHandler.

Bug: 956511
Change-Id: I174e56214a59c8f272c36d983445fe4e230fc8ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1609906
Commit-Queue: Yi Su <mrsuyi@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661301}
parent 02946a3f
...@@ -15,14 +15,17 @@ source_set("navigation") { ...@@ -15,14 +15,17 @@ source_set("navigation") {
deps = [ deps = [
":block_universal_links_buildflags", ":block_universal_links_buildflags",
":core", ":core",
":navigation_manager_util",
"//base", "//base",
"//ios/web:core", "//ios/web:core",
"//ios/web/common", "//ios/web/common",
"//ios/web/navigation:wk_navigation_util", "//ios/web/navigation:wk_navigation_util",
"//ios/web/public", "//ios/web/public",
"//ios/web/web_state:session_certificate_policy_cache", "//ios/web/web_state:session_certificate_policy_cache",
"//ios/web/web_state:user_interaction",
"//ios/web/web_state:web_state_impl_header", "//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state/ui:crw_web_view_navigation_proxy", "//ios/web/web_state/ui:crw_web_view_navigation_proxy",
"//ios/web/web_view",
"//ui/base", "//ui/base",
"//url", "//url",
] ]
......
...@@ -8,21 +8,72 @@ ...@@ -8,21 +8,72 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <WebKit/WebKit.h> #import <WebKit/WebKit.h>
#include "ui/base/page_transition_types.h"
@class CRWWKNavigationHandler;
@class CRWPendingNavigationInfo; @class CRWPendingNavigationInfo;
@class CRWWKNavigationStates; @class CRWWKNavigationStates;
@class CRWWKNavigationHandler; class GURL;
namespace base { namespace base {
class RepeatingTimer; class RepeatingTimer;
} }
namespace web {
struct Referrer;
class WebStateImpl;
class NavigationContextImpl;
class UserInteractionState;
}
// CRWWKNavigationHandler uses this protocol to interact with its owner. // CRWWKNavigationHandler uses this protocol to interact with its owner.
@protocol CRWWKNavigationHandlerDelegate <NSObject> @protocol CRWWKNavigationHandlerDelegate <NSObject>
// Returns associated WebStateImpl.
- (web::WebStateImpl*)webStateImplForNavigationHandler:
(CRWWKNavigationHandler*)navigationHandler;
// Returns associated UserInteractionState.
- (web::UserInteractionState*)userInteractionStateForNavigationHandler:
(CRWWKNavigationHandler*)navigationHandler;
// Returns current Referrer.
- (web::Referrer)currentReferrerForNavigationHandler:
(CRWWKNavigationHandler*)navigationHandler;
// Returns YES if WKWebView was deallocated or is being deallocated. // Returns YES if WKWebView was deallocated or is being deallocated.
- (BOOL)navigationHandlerWebViewBeingDestroyed: - (BOOL)navigationHandlerWebViewBeingDestroyed:
(CRWWKNavigationHandler*)navigationHandler; (CRWWKNavigationHandler*)navigationHandler;
// Returns the actual URL of the document object (i.e., the last committed URL
// of the main frame).
- (GURL)navigationHandlerDocumentURL:(CRWWKNavigationHandler*)navigationHandler;
// Sets document URL to newURL, and updates any relevant state information.
- (void)navigationHandler:(CRWWKNavigationHandler*)navigationHandler
setDocumentURL:(const GURL&)newURL
context:(web::NavigationContextImpl*)context;
// Maps WKNavigationType to ui::PageTransition.
- (ui::PageTransition)navigationHandler:
(CRWWKNavigationHandler*)navigationHandler
pageTransitionFromNavigationType:(WKNavigationType)navigationType;
// Sets up WebUI for URL.
- (void)navigationHandler:(CRWWKNavigationHandler*)navigationHandler
createWebUIForURL:(const GURL&)URL;
// Stop Loading current page.
- (void)navigationHandlerStopLoading:(CRWWKNavigationHandler*)navigationHandler;
// Returns YES if |url| should be loaded in a native view.
- (BOOL)navigationHandler:(CRWWKNavigationHandler*)navigationHandler
shouldLoadURLInNativeView:(const GURL&)url;
// Requires that the next load rebuild the web view. This is expensive, and
// should be used only in the case where something has changed that the web view
// only checks on creation, such that the whole object needs to be rebuilt.
- (void)navigationHandlerRequirePageReconstruction:
(CRWWKNavigationHandler*)navigationHandler;
@end @end
// Handler class for WKNavigationDelegate, deals with navigation callbacks from // Handler class for WKNavigationDelegate, deals with navigation callbacks from
...@@ -31,6 +82,10 @@ class RepeatingTimer; ...@@ -31,6 +82,10 @@ class RepeatingTimer;
@property(nonatomic, weak) id<CRWWKNavigationHandlerDelegate> delegate; @property(nonatomic, weak) id<CRWWKNavigationHandlerDelegate> delegate;
// TODO(crbug.com/956511): Change this to readonly when
// |webViewWebProcessDidCrash| is moved to CRWWKNavigationHandler.
@property(nonatomic, assign) BOOL webProcessCrashed;
// Pending information for an in-progress page navigation. The lifetime of // Pending information for an in-progress page navigation. The lifetime of
// this object starts at |decidePolicyForNavigationAction| where the info is // this object starts at |decidePolicyForNavigationAction| where the info is
// extracted from the request, and ends at either |didCommitNavigation| or // extracted from the request, and ends at either |didCommitNavigation| or
...@@ -46,9 +101,19 @@ class RepeatingTimer; ...@@ -46,9 +101,19 @@ class RepeatingTimer;
@property(nonatomic, readonly, assign) @property(nonatomic, readonly, assign)
base::RepeatingTimer* safeBrowsingWarningDetectionTimer; base::RepeatingTimer* safeBrowsingWarningDetectionTimer;
// Discards non committed items, only if the last committed URL was not loaded
// in native view. But if it was a native view, no discard will happen to avoid
// an ugly animation where the web view is inserted and quickly removed.
- (void)discardNonCommittedItemsIfLastCommittedWasNotNativeView;
// Instructs this handler to stop loading. // Instructs this handler to stop loading.
- (void)stopLoading; - (void)stopLoading;
// Returns context for pending navigation that has |URL|. null if there is no
// matching pending navigation.
- (web::NavigationContextImpl*)contextForPendingMainFrameNavigationWithURL:
(const GURL&)URL;
@end @end
#endif // IOS_WEB_NAVIGATION_CRW_WK_NAVIGATION_HANDLER_H_ #endif // IOS_WEB_NAVIGATION_CRW_WK_NAVIGATION_HANDLER_H_
...@@ -74,7 +74,8 @@ class WebStateImpl; ...@@ -74,7 +74,8 @@ class WebStateImpl;
@property(nonatomic, readonly) double loadingProgress; @property(nonatomic, readonly) double loadingProgress;
// YES if the web process backing WebView is believed to currently be crashed. // YES if the web process backing WebView is believed to currently be crashed.
@property(nonatomic, assign, getter=isWebProcessCrashed) BOOL webProcessCrashed; @property(nonatomic, readonly, assign, getter=isWebProcessCrashed)
BOOL webProcessCrashed;
// Whether the WebController is visible. Returns YES after wasShown call and // Whether the WebController is visible. Returns YES after wasShown call and
// NO after wasHidden() call. // NO after wasHidden() call.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment