Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: components/navigation_interception/intercept_navigation_throttle.h

Issue 1414723008: Add a way to cancel deferred navigations in NavigationHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/navigation_interception/intercept_navigation_throttle.h
diff --git a/components/navigation_interception/intercept_navigation_throttle.h b/components/navigation_interception/intercept_navigation_throttle.h
index 0b7f74605378266e5e09a549127d53639e1617a4..7ce296380e6c428b5939017b7acb873139aa18a9 100644
--- a/components/navigation_interception/intercept_navigation_throttle.h
+++ b/components/navigation_interception/intercept_navigation_throttle.h
@@ -31,7 +31,8 @@ class InterceptNavigationThrottle : public content::NavigationThrottle {
CheckCallback;
InterceptNavigationThrottle(content::NavigationHandle* navigation_handle,
- CheckCallback should_ignore_callback);
+ CheckCallback should_ignore_callback,
+ bool run_callback_synchronously);
~InterceptNavigationThrottle() override;
// content::NavigationThrottle implementation:
@@ -41,8 +42,19 @@ class InterceptNavigationThrottle : public content::NavigationThrottle {
private:
ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect);
+ // Called to perform the checks asynchronously
+ void RunCallbackAsynchronously(const NavigationParams& navigation_params);
+ void OnAsynchronousChecksPerformed(bool should_ignore_navigation);
+
CheckCallback should_ignore_callback_;
+ // Whether the callback will be run synchronously or not. If the callback can
+ // lead to the destruction of the WebContents, this should be false.
+ // Otherwise this should be true.
+ const bool run_callback_synchronously_;
+
+ base::WeakPtrFactory<InterceptNavigationThrottle> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(InterceptNavigationThrottle);
};

Powered by Google App Engine
This is Rietveld 408576698