OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/navigation_interception/intercept_navigation_resource_throt
tle.h" | 5 #include "components/navigation_interception/intercept_navigation_resource_throt
tle.h" |
6 | 6 |
7 #include "components/navigation_interception/navigation_params.h" | 7 #include "components/navigation_interception/navigation_params.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/child_process_security_policy.h" | 9 #include "content/public/browser/child_process_security_policy.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle( | 67 InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle( |
68 net::URLRequest* request, | 68 net::URLRequest* request, |
69 CheckOnUIThreadCallback should_ignore_callback) | 69 CheckOnUIThreadCallback should_ignore_callback) |
70 : request_(request), | 70 : request_(request), |
71 should_ignore_callback_(should_ignore_callback), | 71 should_ignore_callback_(should_ignore_callback), |
72 weak_ptr_factory_(this) { | 72 weak_ptr_factory_(this) { |
73 } | 73 } |
74 | 74 |
75 InterceptNavigationResourceThrottle::~InterceptNavigationResourceThrottle() { | 75 InterceptNavigationResourceThrottle::~InterceptNavigationResourceThrottle() { |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 76 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
77 } | 77 } |
78 | 78 |
79 void InterceptNavigationResourceThrottle::WillStartRequest(bool* defer) { | 79 void InterceptNavigationResourceThrottle::WillStartRequest(bool* defer) { |
80 *defer = | 80 *defer = |
81 CheckIfShouldIgnoreNavigation(request_->url(), request_->method(), false); | 81 CheckIfShouldIgnoreNavigation(request_->url(), request_->method(), false); |
82 } | 82 } |
83 | 83 |
84 void InterceptNavigationResourceThrottle::WillRedirectRequest( | 84 void InterceptNavigationResourceThrottle::WillRedirectRequest( |
85 const net::RedirectInfo& redirect_info, | 85 const net::RedirectInfo& redirect_info, |
86 bool* defer) { | 86 bool* defer) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 &InterceptNavigationResourceThrottle::OnResultObtained, | 127 &InterceptNavigationResourceThrottle::OnResultObtained, |
128 weak_ptr_factory_.GetWeakPtr()))); | 128 weak_ptr_factory_.GetWeakPtr()))); |
129 | 129 |
130 // Defer request while we wait for the UI thread to check if the navigation | 130 // Defer request while we wait for the UI thread to check if the navigation |
131 // should be ignored. | 131 // should be ignored. |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 void InterceptNavigationResourceThrottle::OnResultObtained( | 135 void InterceptNavigationResourceThrottle::OnResultObtained( |
136 bool should_ignore_navigation) { | 136 bool should_ignore_navigation) { |
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 137 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
138 | 138 |
139 if (should_ignore_navigation) { | 139 if (should_ignore_navigation) { |
140 controller()->CancelAndIgnore(); | 140 controller()->CancelAndIgnore(); |
141 } else { | 141 } else { |
142 controller()->Resume(); | 142 controller()->Resume(); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace navigation_interception | 146 } // namespace navigation_interception |
OLD | NEW |