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/browsing_data/clear_site_data_header_observer.h" |
10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
11 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
12 #include "content/browser/frame_host/navigator.h" | 13 #include "content/browser/frame_host/navigator.h" |
13 #include "content/browser/frame_host/navigator_delegate.h" | 14 #include "content/browser/frame_host/navigator_delegate.h" |
14 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
15 #include "content/common/frame_messages.h" | 16 #include "content/common/frame_messages.h" |
16 #include "content/common/resource_request_body_impl.h" | 17 #include "content/common/resource_request_body_impl.h" |
17 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
18 #include "content/public/common/browser_side_navigation_policy.h" | 19 #include "content/public/common/browser_side_navigation_policy.h" |
19 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 net_error_code_(net::OK), | 64 net_error_code_(net::OK), |
64 render_frame_host_(nullptr), | 65 render_frame_host_(nullptr), |
65 is_renderer_initiated_(is_renderer_initiated), | 66 is_renderer_initiated_(is_renderer_initiated), |
66 is_same_page_(false), | 67 is_same_page_(false), |
67 is_synchronous_(is_synchronous), | 68 is_synchronous_(is_synchronous), |
68 is_srcdoc_(is_srcdoc), | 69 is_srcdoc_(is_srcdoc), |
69 was_redirected_(false), | 70 was_redirected_(false), |
70 state_(INITIAL), | 71 state_(INITIAL), |
71 is_transferring_(false), | 72 is_transferring_(false), |
72 frame_tree_node_(frame_tree_node), | 73 frame_tree_node_(frame_tree_node), |
| 74 clear_site_data_header_observer_( |
| 75 ClearSiteDataHeaderObserver::CreateFor(this)), |
73 next_index_(0), | 76 next_index_(0), |
74 navigation_start_(navigation_start), | 77 navigation_start_(navigation_start), |
75 pending_nav_entry_id_(pending_nav_entry_id), | 78 pending_nav_entry_id_(pending_nav_entry_id), |
76 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED) { | 79 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED) { |
77 DCHECK(!navigation_start.is_null()); | 80 DCHECK(!navigation_start.is_null()); |
78 GetDelegate()->DidStartNavigation(this); | 81 GetDelegate()->DidStartNavigation(this); |
79 | 82 |
80 if (IsInMainFrame()) { | 83 if (IsInMainFrame()) { |
81 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 84 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
82 "navigation", "Navigation StartToCommit", this, | 85 "navigation", "Navigation StartToCommit", this, |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 complete_callback_.Reset(); | 542 complete_callback_.Reset(); |
540 | 543 |
541 if (!callback.is_null()) | 544 if (!callback.is_null()) |
542 callback.Run(result); | 545 callback.Run(result); |
543 | 546 |
544 // No code after running the callback, as it might have resulted in our | 547 // No code after running the callback, as it might have resulted in our |
545 // destruction. | 548 // destruction. |
546 } | 549 } |
547 | 550 |
548 void NavigationHandleImpl::RegisterNavigationThrottles() { | 551 void NavigationHandleImpl::RegisterNavigationThrottles() { |
549 // Register the navigation throttles. The ScopedVector returned by | 552 // Register the embedder's navigation throttles. The ScopedVector returned by |
550 // GetNavigationThrottles is not assigned to throttles_ directly because it | 553 // GetNavigationThrottles is not assigned to throttles_ directly because it |
551 // would overwrite any throttle previously added with | 554 // would overwrite any throttle previously added with |
552 // RegisterThrottleForTesting. | 555 // RegisterThrottleForTesting. |
553 ScopedVector<NavigationThrottle> throttles_to_register = | 556 ScopedVector<NavigationThrottle> throttles_to_register = |
554 GetContentClient()->browser()->CreateThrottlesForNavigation(this); | 557 GetContentClient()->browser()->CreateThrottlesForNavigation(this); |
555 if (throttles_to_register.size() > 0) { | 558 if (throttles_to_register.size() > 0) { |
556 throttles_.insert(throttles_.end(), throttles_to_register.begin(), | 559 throttles_.insert(throttles_.end(), throttles_to_register.begin(), |
557 throttles_to_register.end()); | 560 throttles_to_register.end()); |
558 throttles_to_register.weak_clear(); | 561 throttles_to_register.weak_clear(); |
559 } | 562 } |
560 std::unique_ptr<NavigationThrottle> devtools_throttle = | 563 std::unique_ptr<NavigationThrottle> devtools_throttle = |
561 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); | 564 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |
562 if (devtools_throttle) | 565 if (devtools_throttle) |
563 throttles_.push_back(devtools_throttle.release()); | 566 throttles_.push_back(devtools_throttle.release()); |
564 } | 567 } |
565 | 568 |
566 } // namespace content | 569 } // namespace content |
OLD | NEW |