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

Unified Diff: content/public/browser/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
« no previous file with comments | « content/public/browser/navigation_handle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/navigation_throttle.h
diff --git a/content/public/browser/navigation_throttle.h b/content/public/browser/navigation_throttle.h
index c5202ae71d89d47990394423a87c943af488d66c..fff64b1f4fb8c61f425c27b140786fce5eaa617d 100644
--- a/content/public/browser/navigation_throttle.h
+++ b/content/public/browser/navigation_throttle.h
@@ -17,8 +17,20 @@ class CONTENT_EXPORT NavigationThrottle {
// This is returned to the NavigationHandle to allow the navigation to
// proceed, or to cancel it.
enum ThrottleCheckResult {
+ // The navigation proceeds uninterrupted.
PROCEED,
+
+ // Defers the navigation until the NavigationThrottle calls
+ // NavigationHandle::Resume or NavigationHandle::CancelDeferredRequest.
+ // If the NavigationHandle is destroyed while the navigation is deferred,
+ // the navigation will be canceled in the network stack.
DEFER,
+
+ // Cancels the navigation.
+ CANCEL,
+
+ // Cancels the navigation and makes the requester of the navigation acts
+ // like the request was never made.
CANCEL_AND_IGNORE,
};
@@ -26,9 +38,21 @@ class CONTENT_EXPORT NavigationThrottle {
virtual ~NavigationThrottle();
// Called when a network request is about to be made for this navigation.
+ //
+ // The implementer is responsible for ensuring that the WebContents this
+ // throttle is associated with remain alive during the duration of this
+ // method. Failing to do so will result in use-after-free bugs. Should the
+ // implementer need to destroy the WebContents, it should return CANCEL,
+ // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously.
virtual ThrottleCheckResult WillStartRequest();
// Called when a server redirect is received by the navigation.
+ //
+ // The implementer is responsible for ensuring that the WebContents this
+ // throttle is associated with remain alive during the duration of this
+ // method. Failing to do so will result in use-after-free bugs. Should the
+ // implementer need to destroy the WebContents, it should return CANCEL,
+ // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously.
virtual ThrottleCheckResult WillRedirectRequest();
// The NavigationHandle that is tracking the information related to this
« no previous file with comments | « content/public/browser/navigation_handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698