OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/public/browser/navigation_throttle.h" | 10 #include "content/public/browser/navigation_throttle.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 namespace protocol { | 13 namespace protocol { |
14 class PageHandler; | 14 class PageHandler; |
15 } // namespace protocol | 15 } // namespace protocol |
16 | 16 |
17 // Used to allow the DevTools client to optionally cancel navigations via the | 17 // Used to allow the DevTools client to optionally cancel navigations via the |
18 // Page.setControlNavigations and Page.processNavigation commands. | 18 // Page.setControlNavigations and Page.processNavigation commands. |
19 class PageNavigationThrottle : public content::NavigationThrottle { | 19 class PageNavigationThrottle : public content::NavigationThrottle { |
20 public: | 20 public: |
21 PageNavigationThrottle(base::WeakPtr<protocol::PageHandler> page_handler, | 21 PageNavigationThrottle(base::WeakPtr<protocol::PageHandler> page_handler, |
22 int navigation_id, | 22 int navigation_id, |
23 content::NavigationHandle* navigation_handle); | 23 content::NavigationHandle* navigation_handle); |
24 ~PageNavigationThrottle() override; | 24 ~PageNavigationThrottle() override; |
25 | 25 |
26 // content::NavigationThrottle implementation: | 26 // content::NavigationThrottle implementation: |
27 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | 27 NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
28 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; | 28 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; |
| 29 const char* GetNameForLogging() override; |
29 | 30 |
30 int navigation_id() const { return navigation_id_; } | 31 int navigation_id() const { return navigation_id_; } |
31 | 32 |
32 // Tells the PageNavigationThrottle to not throttle anything! | 33 // Tells the PageNavigationThrottle to not throttle anything! |
33 void AlwaysProceed(); | 34 void AlwaysProceed(); |
34 | 35 |
35 // Resumes a deferred navigation request. Does nothing if a response isn't | 36 // Resumes a deferred navigation request. Does nothing if a response isn't |
36 // expected. | 37 // expected. |
37 void Resume(); | 38 void Resume(); |
38 | 39 |
(...skipping 12 matching lines...) Expand all Loading... |
51 // Whether or not a navigation was deferred. If deferred we expect a | 52 // Whether or not a navigation was deferred. If deferred we expect a |
52 // subsequent call to AlwaysProceed, Resume or CancelDeferredNavigation. | 53 // subsequent call to AlwaysProceed, Resume or CancelDeferredNavigation. |
53 bool navigation_deferred_; | 54 bool navigation_deferred_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(PageNavigationThrottle); | 56 DISALLOW_COPY_AND_ASSIGN(PageNavigationThrottle); |
56 }; | 57 }; |
57 | 58 |
58 } // namespace content | 59 } // namespace content |
59 | 60 |
60 #endif // CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ | 61 #endif // CONTENT_BROWSER_DEVTOOLS_PAGE_NAVIGATION_THROTTLE_H_ |
OLD | NEW |