OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | |
10 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
11 #include "content/browser/frame_host/navigator.h" | 12 #include "content/browser/frame_host/navigator.h" |
12 #include "content/browser/frame_host/navigator_delegate.h" | 13 #include "content/browser/frame_host/navigator_delegate.h" |
13 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 14 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
14 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
15 #include "content/common/resource_request_body_impl.h" | 16 #include "content/common/resource_request_body_impl.h" |
16 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
17 #include "content/public/common/browser_side_navigation_policy.h" | 18 #include "content/public/common/browser_side_navigation_policy.h" |
18 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
19 #include "net/url_request/redirect_info.h" | 20 #include "net/url_request/redirect_info.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 transition_ = transition; | 321 transition_ = transition; |
321 is_external_protocol_ = is_external_protocol; | 322 is_external_protocol_ = is_external_protocol; |
322 | 323 |
323 state_ = WILL_SEND_REQUEST; | 324 state_ = WILL_SEND_REQUEST; |
324 complete_callback_ = callback; | 325 complete_callback_ = callback; |
325 | 326 |
326 // Register the navigation throttles. The ScopedVector returned by | 327 // Register the navigation throttles. The ScopedVector returned by |
327 // GetNavigationThrottles is not assigned to throttles_ directly because it | 328 // GetNavigationThrottles is not assigned to throttles_ directly because it |
328 // would overwrite any throttle previously added with | 329 // would overwrite any throttle previously added with |
329 // RegisterThrottleForTesting. | 330 // RegisterThrottleForTesting. |
330 ScopedVector<NavigationThrottle> throttles_to_register = | 331 ScopedVector<NavigationThrottle> throttles_to_register = |
clamy
2016/07/08 15:47:33
Considering that we're now adding more than one th
alex clarke (OOO till 29th)
2016/07/08 17:15:40
I'm not 100% sure if I've done what you had in min
| |
331 GetContentClient()->browser()->CreateThrottlesForNavigation(this); | 332 GetContentClient()->browser()->CreateThrottlesForNavigation(this); |
332 if (throttles_to_register.size() > 0) { | 333 if (throttles_to_register.size() > 0) { |
333 throttles_.insert(throttles_.end(), throttles_to_register.begin(), | 334 throttles_.insert(throttles_.end(), throttles_to_register.begin(), |
334 throttles_to_register.end()); | 335 throttles_to_register.end()); |
335 throttles_to_register.weak_clear(); | 336 throttles_to_register.weak_clear(); |
336 } | 337 } |
338 std::unique_ptr<NavigationThrottle> devtools_throttle = | |
339 RenderFrameDevToolsAgentHost::GetThrottleForNavigation(this); | |
340 if (devtools_throttle) | |
341 throttles_.push_back(devtools_throttle.release()); | |
337 | 342 |
338 // Notify each throttle of the request. | 343 // Notify each throttle of the request. |
339 NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest(); | 344 NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest(); |
340 | 345 |
341 // If the navigation is not deferred, run the callback. | 346 // If the navigation is not deferred, run the callback. |
342 if (result != NavigationThrottle::DEFER) | 347 if (result != NavigationThrottle::DEFER) |
343 RunCompleteCallback(result); | 348 RunCompleteCallback(result); |
344 } | 349 } |
345 | 350 |
346 void NavigationHandleImpl::WillRedirectRequest( | 351 void NavigationHandleImpl::WillRedirectRequest( |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 complete_callback_.Reset(); | 532 complete_callback_.Reset(); |
528 | 533 |
529 if (!callback.is_null()) | 534 if (!callback.is_null()) |
530 callback.Run(result); | 535 callback.Run(result); |
531 | 536 |
532 // No code after running the callback, as it might have resulted in our | 537 // No code after running the callback, as it might have resulted in our |
533 // destruction. | 538 // destruction. |
534 } | 539 } |
535 | 540 |
536 } // namespace content | 541 } // namespace content |
OLD | NEW |