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

Unified Diff: content/public/browser/navigation_throttle.h

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 years, 3 months 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: content/public/browser/navigation_throttle.h
diff --git a/content/public/browser/navigation_throttle.h b/content/public/browser/navigation_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..8dbc2dfa067cbeb2efe189b101661a344f29433d
--- /dev/null
+++ b/content/public/browser/navigation_throttle.h
@@ -0,0 +1,43 @@
+// Copyright 2015 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 CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
+#define CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
+
+#include "content/common/content_export.h"
+
+namespace content {
+class NavigationHandle;
+
+// A NavigationThrottle tracks and allows interaction with a navigation on the
+// UI thread.
+class CONTENT_EXPORT NavigationThrottle {
+ public:
+ // This is returned to the navigation handler to allow the navigation to
Charlie Reis 2015/09/11 00:06:49 What's a navigation handler? (Let's try to be mor
clamy 2015/09/11 13:30:44 I meant a NavigationHandle, will change that in th
clamy 2015/09/16 01:03:22 Done.
+ // proceed, or to cancel it.
+ enum ThrottleCheckResult {
+ PROCEED,
+ CANCEL_AND_IGNORE,
+ };
+
+ NavigationThrottle(NavigationHandle* navigation_handle);
+ virtual ~NavigationThrottle();
+
+ // Called when a network request is about to be made for this navigation.
+ virtual ThrottleCheckResult WillStartRequest();
+
+ // Called when a server redirect is received by the navigation.
+ virtual ThrottleCheckResult WillRedirectRequest();
+
+ // The NavigationHandle that is tracking the information related to this
+ // navigation.
+ NavigationHandle* navigation_handle() const { return navigation_handle_; }
+
+ private:
+ NavigationHandle* navigation_handle_;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698