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

Unified Diff: content/browser/devtools/page_navigation_throttle.h

Issue 2132673002: Adding Navigation Throttles to DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved RegisterNavigationThrottles Created 4 years, 5 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/browser/devtools/page_navigation_throttle.h
diff --git a/content/browser/devtools/page_navigation_throttle.h b/content/browser/devtools/page_navigation_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..84276b78b7d553d0dcd5db2654719fae7a970d1d
--- /dev/null
+++ b/content/browser/devtools/page_navigation_throttle.h
@@ -0,0 +1,54 @@
+// Copyright 2016 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_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_
+#define CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/navigation_throttle.h"
+
+namespace content {
+namespace devtools {
+namespace page {
+class PageHandler;
+} // namespace page
+
+class PageNavigationThrottle : public content::NavigationThrottle {
nasko 2016/07/12 18:03:11 Can you put a class level comment? What is this cl
alex clarke (OOO till 29th) 2016/07/12 20:36:14 Done.
+ public:
+ PageNavigationThrottle(base::WeakPtr<page::PageHandler> page_handler,
+ int navigation_id,
+ content::NavigationHandle* navigation_handle);
+ ~PageNavigationThrottle() override;
+
+ // content::NavigationThrottle implementation:
+ NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
+ NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
+ NavigationThrottle::ThrottleCheckResult WillProcessResponse() override;
+
+ int navigation_id() const { return navigation_id_; }
+
+ // Tells the PageNavigationThrottle to not throttle anything!
+ void AlwaysProceed();
+
+ // Resumes a deferred navigation request. Does nothing if a response isn't
+ // expected.
+ void Resume();
+
+ // Cancels a deferred navigation request. Does nothing if a response isn't
+ // expected.
+ void CancelDeferredNavigation(NavigationThrottle::ThrottleCheckResult result);
+
+ private:
+ int navigation_id_;
+ base::WeakPtr<page::PageHandler> page_handler_;
+ bool response_pending_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageNavigationThrottle);
+};
+
+} // namespace devtools
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698