Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "content/public/browser/navigation_throttle.h" | |
| 11 | |
| 12 namespace content { | |
| 13 namespace devtools { | |
| 14 namespace page { | |
| 15 class PageHandler; | |
| 16 } // namespace page | |
| 17 | |
| 18 // Used to allow the DevTools client to optionally cancel navigations via the | |
| 19 // Page.setControlNavigations and Page.processNavigation commands. | |
| 20 class PageNavigationThrottle : public content::NavigationThrottle { | |
| 21 public: | |
| 22 PageNavigationThrottle(base::WeakPtr<page::PageHandler> page_handler, | |
| 23 int navigation_id, | |
| 24 content::NavigationHandle* navigation_handle); | |
| 25 ~PageNavigationThrottle() override; | |
| 26 | |
| 27 // content::NavigationThrottle implementation: | |
| 28 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | |
| 29 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; | |
| 30 | |
| 31 int navigation_id() const { return navigation_id_; } | |
| 32 | |
| 33 // Tells the PageNavigationThrottle to not throttle anything! | |
| 34 void AlwaysProceed(); | |
| 35 | |
| 36 // Resumes a deferred navigation request. Does nothing if a response isn't | |
| 37 // expected. | |
| 38 void Resume(); | |
| 39 | |
| 40 // Cancels a deferred navigation request. Does nothing if a response isn't | |
| 41 // expected. | |
| 42 void CancelDeferredNavigation(NavigationThrottle::ThrottleCheckResult result); | |
| 43 | |
| 44 private: | |
| 45 int navigation_id_; | |
| 46 base::WeakPtr<page::PageHandler> page_handler_; | |
| 47 bool response_pending_; | |
|
nasko
2016/07/13 22:37:34
nit: Some basic comments on these will be useful.
alex clarke (OOO till 29th)
2016/07/14 16:06:04
Done.
| |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(PageNavigationThrottle); | |
| 50 }; | |
| 51 | |
| 52 } // namespace devtools | |
| 53 } // namespace content | |
| 54 | |
| 55 #endif // CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | |
| OLD | NEW |