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 #include "content/browser/devtools/page_navigation_throttle.h" | 5 #include "content/browser/devtools/page_navigation_throttle.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/browser/devtools/protocol/page_handler.h" | 8 #include "content/browser/devtools/protocol/page_handler.h" |
9 #include "content/public/browser/navigation_handle.h" | 9 #include "content/public/browser/navigation_handle.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 navigation_deferred_(false) {} | 22 navigation_deferred_(false) {} |
23 | 23 |
24 PageNavigationThrottle::~PageNavigationThrottle() { | 24 PageNavigationThrottle::~PageNavigationThrottle() { |
25 if (page_handler_) | 25 if (page_handler_) |
26 page_handler_->OnPageNavigationThrottleDisposed(navigation_id_); | 26 page_handler_->OnPageNavigationThrottleDisposed(navigation_id_); |
27 } | 27 } |
28 | 28 |
29 NavigationThrottle::ThrottleCheckResult | 29 NavigationThrottle::ThrottleCheckResult |
30 PageNavigationThrottle::WillStartRequest() { | 30 PageNavigationThrottle::WillStartRequest() { |
31 if (!page_handler_) | 31 if (!page_handler_) |
32 return ThrottleCheckResult::PROCEED; | 32 return NavigationThrottle::PROCEED; |
33 navigation_deferred_ = true; | 33 navigation_deferred_ = true; |
34 page_handler_->NavigationRequested(this); | 34 page_handler_->NavigationRequested(this); |
35 return ThrottleCheckResult::DEFER; | 35 return NavigationThrottle::DEFER; |
36 } | 36 } |
37 | 37 |
38 NavigationThrottle::ThrottleCheckResult | 38 NavigationThrottle::ThrottleCheckResult |
39 PageNavigationThrottle::WillRedirectRequest() { | 39 PageNavigationThrottle::WillRedirectRequest() { |
40 if (!page_handler_) | 40 if (!page_handler_) |
41 return ThrottleCheckResult::PROCEED; | 41 return NavigationThrottle::PROCEED; |
42 navigation_deferred_ = true; | 42 navigation_deferred_ = true; |
43 page_handler_->NavigationRequested(this); | 43 page_handler_->NavigationRequested(this); |
44 return ThrottleCheckResult::DEFER; | 44 return NavigationThrottle::DEFER; |
45 } | 45 } |
46 | 46 |
47 const char* PageNavigationThrottle::GetNameForLogging() { | 47 const char* PageNavigationThrottle::GetNameForLogging() { |
48 return "PageNavigationThrottle"; | 48 return "PageNavigationThrottle"; |
49 } | 49 } |
50 | 50 |
51 void PageNavigationThrottle::AlwaysProceed() { | 51 void PageNavigationThrottle::AlwaysProceed() { |
52 // Makes WillStartRequest and WillRedirectRequest always return | 52 // Makes WillStartRequest and WillRedirectRequest always return |
53 // ThrottleCheckResult::PROCEED. | 53 // ThrottleCheckResult::PROCEED. |
54 page_handler_.reset(); | 54 page_handler_.reset(); |
(...skipping 17 matching lines...) Expand all Loading... |
72 if (!navigation_deferred_) | 72 if (!navigation_deferred_) |
73 return; | 73 return; |
74 navigation_deferred_ = false; | 74 navigation_deferred_ = false; |
75 navigation_handle()->CancelDeferredNavigation(result); | 75 navigation_handle()->CancelDeferredNavigation(result); |
76 | 76 |
77 // Do not add code after this as the PageNavigationThrottle may be deleted by | 77 // Do not add code after this as the PageNavigationThrottle may be deleted by |
78 // the line above. | 78 // the line above. |
79 } | 79 } |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
OLD | NEW |