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.setNavigationThrottleEnabled and Page.processNavigation commands. | |
nasko
2016/07/12 23:08:21
Is Page.setNavigationThrottleEnabled going to be a
dgozman
2016/07/12 23:56:16
I don't think this will be temporary. We can renam
alex clarke (OOO till 29th)
2016/07/13 09:18:44
Right it's not meant to be temporary, the ability
nasko
2016/07/13 14:55:55
Let's call the method something more generic. I th
alex clarke (OOO till 29th)
2016/07/13 16:14:24
Done.
| |
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_; | |
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 |