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 26 matching lines...) Expand all Loading... |
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 ThrottleCheckResult::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 ThrottleCheckResult::DEFER; |
45 } | 45 } |
46 | 46 |
| 47 const char* PageNavigationThrottle::GetNameForLogging() { |
| 48 return "PageNavigationThrottle"; |
| 49 } |
| 50 |
47 void PageNavigationThrottle::AlwaysProceed() { | 51 void PageNavigationThrottle::AlwaysProceed() { |
48 // Makes WillStartRequest and WillRedirectRequest always return | 52 // Makes WillStartRequest and WillRedirectRequest always return |
49 // ThrottleCheckResult::PROCEED. | 53 // ThrottleCheckResult::PROCEED. |
50 page_handler_.reset(); | 54 page_handler_.reset(); |
51 | 55 |
52 if (navigation_deferred_) | 56 if (navigation_deferred_) |
53 Resume(); | 57 Resume(); |
54 } | 58 } |
55 | 59 |
56 void PageNavigationThrottle::Resume() { | 60 void PageNavigationThrottle::Resume() { |
(...skipping 11 matching lines...) Expand all Loading... |
68 if (!navigation_deferred_) | 72 if (!navigation_deferred_) |
69 return; | 73 return; |
70 navigation_deferred_ = false; | 74 navigation_deferred_ = false; |
71 navigation_handle()->CancelDeferredNavigation(result); | 75 navigation_handle()->CancelDeferredNavigation(result); |
72 | 76 |
73 // 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 |
74 // the line above. | 78 // the line above. |
75 } | 79 } |
76 | 80 |
77 } // namespace content | 81 } // namespace content |
OLD | NEW |