OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "content/browser/frame_host/navigation_controller_impl.h" | 14 #include "content/browser/frame_host/navigation_controller_impl.h" |
15 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/navigation_params.h" | 17 #include "content/common/navigation_params.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class NavigationControllerImpl; | 24 class NavigationControllerImpl; |
25 class NavigatorDelegate; | 25 class NavigatorDelegate; |
26 class NavigatorTest; | 26 class NavigatorTest; |
27 class ResourceRequestBody; | |
27 struct LoadCommittedDetails; | 28 struct LoadCommittedDetails; |
28 | 29 |
29 // This class is an implementation of Navigator, responsible for managing | 30 // This class is an implementation of Navigator, responsible for managing |
30 // navigations in regular browser tabs. | 31 // navigations in regular browser tabs. |
31 class CONTENT_EXPORT NavigatorImpl : public Navigator { | 32 class CONTENT_EXPORT NavigatorImpl : public Navigator { |
32 public: | 33 public: |
33 NavigatorImpl(NavigationControllerImpl* navigation_controller, | 34 NavigatorImpl(NavigationControllerImpl* navigation_controller, |
34 NavigatorDelegate* delegate); | 35 NavigatorDelegate* delegate); |
35 | 36 |
36 static void CheckWebUIRendererDoesNotDisplayNormalURL( | 37 static void CheckWebUIRendererDoesNotDisplayNormalURL( |
(...skipping 25 matching lines...) Expand all Loading... | |
62 bool is_same_document_history_load) override; | 63 bool is_same_document_history_load) override; |
63 bool NavigateNewChildFrame(RenderFrameHostImpl* render_frame_host, | 64 bool NavigateNewChildFrame(RenderFrameHostImpl* render_frame_host, |
64 const std::string& unique_name) override; | 65 const std::string& unique_name) override; |
65 void RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 66 void RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
66 const GURL& url, | 67 const GURL& url, |
67 SiteInstance* source_site_instance, | 68 SiteInstance* source_site_instance, |
68 const Referrer& referrer, | 69 const Referrer& referrer, |
69 WindowOpenDisposition disposition, | 70 WindowOpenDisposition disposition, |
70 bool should_replace_current_entry, | 71 bool should_replace_current_entry, |
71 bool user_gesture) override; | 72 bool user_gesture) override; |
72 void RequestTransferURL(RenderFrameHostImpl* render_frame_host, | 73 void RequestTransferURL( |
73 const GURL& url, | 74 RenderFrameHostImpl* render_frame_host, |
74 SiteInstance* source_site_instance, | 75 const GURL& url, |
75 const std::vector<GURL>& redirect_chain, | 76 SiteInstance* source_site_instance, |
76 const Referrer& referrer, | 77 const std::vector<GURL>& redirect_chain, |
77 ui::PageTransition page_transition, | 78 const Referrer& referrer, |
78 const GlobalRequestID& transferred_global_request_id, | 79 ui::PageTransition page_transition, |
79 bool should_replace_current_entry) override; | 80 const GlobalRequestID& transferred_global_request_id, |
81 bool should_replace_current_entry, | |
82 const std::string& method, | |
83 const scoped_refptr<ResourceRequestBody>& post_body) override; | |
clamy
2016/05/23 15:32:28
A const scoped_refptr<...>& looks very weird. Do w
Łukasz Anforowicz
2016/05/23 16:25:10
2286 hits in code search :-) [1]
This pattern avo
| |
80 void OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, bool proceed) override; | 84 void OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, bool proceed) override; |
81 void OnBeginNavigation(FrameTreeNode* frame_tree_node, | 85 void OnBeginNavigation(FrameTreeNode* frame_tree_node, |
82 const CommonNavigationParams& common_params, | 86 const CommonNavigationParams& common_params, |
83 const BeginNavigationParams& begin_params) override; | 87 const BeginNavigationParams& begin_params) override; |
84 void FailedNavigation(FrameTreeNode* frame_tree_node, | 88 void FailedNavigation(FrameTreeNode* frame_tree_node, |
85 bool has_stale_copy_in_cache, | 89 bool has_stale_copy_in_cache, |
86 int error_code) override; | 90 int error_code) override; |
87 void LogResourceRequestTime(base::TimeTicks timestamp, | 91 void LogResourceRequestTime(base::TimeTicks timestamp, |
88 const GURL& url) override; | 92 const GURL& url) override; |
89 void LogBeforeUnloadTime( | 93 void LogBeforeUnloadTime( |
90 const base::TimeTicks& renderer_before_unload_start_time, | 94 const base::TimeTicks& renderer_before_unload_start_time, |
91 const base::TimeTicks& renderer_before_unload_end_time) override; | 95 const base::TimeTicks& renderer_before_unload_end_time) override; |
92 void CancelNavigation(FrameTreeNode* frame_tree_node) override; | 96 void CancelNavigation(FrameTreeNode* frame_tree_node) override; |
93 | 97 |
94 private: | 98 private: |
95 // Holds data used to track browser side navigation metrics. | 99 // Holds data used to track browser side navigation metrics. |
96 struct NavigationMetricsData; | 100 struct NavigationMetricsData; |
97 | 101 |
98 friend class NavigatorTestWithBrowserSideNavigation; | 102 friend class NavigatorTestWithBrowserSideNavigation; |
99 ~NavigatorImpl() override; | 103 ~NavigatorImpl() override; |
100 | 104 |
101 // Navigates to the given entry, which might be the pending entry (if | 105 // Navigates to the given entry, which might be the pending entry (if |
102 // |is_pending_entry| is true). Private because all callers should use either | 106 // |is_pending_entry| is true). Private because all callers should use either |
103 // NavigateToPendingEntry or NavigateToNewChildFrame. | 107 // NavigateToPendingEntry or NavigateToNewChildFrame. |
104 bool NavigateToEntry(FrameTreeNode* frame_tree_node, | 108 bool NavigateToEntry(FrameTreeNode* frame_tree_node, |
105 const FrameNavigationEntry& frame_entry, | 109 const FrameNavigationEntry& frame_entry, |
106 const NavigationEntryImpl& entry, | 110 const NavigationEntryImpl& entry, |
107 NavigationController::ReloadType reload_type, | 111 NavigationController::ReloadType reload_type, |
108 bool is_same_document_history_load, | 112 bool is_same_document_history_load, |
109 bool is_pending_entry); | 113 bool is_pending_entry, |
114 const scoped_refptr<ResourceRequestBody>& post_body); | |
110 | 115 |
111 bool ShouldAssignSiteForURL(const GURL& url); | 116 bool ShouldAssignSiteForURL(const GURL& url); |
112 | 117 |
113 // PlzNavigate: if needed, sends a BeforeUnload IPC to the renderer to ask it | 118 // PlzNavigate: if needed, sends a BeforeUnload IPC to the renderer to ask it |
114 // to execute the beforeUnload event. Otherwise, the navigation request will | 119 // to execute the beforeUnload event. Otherwise, the navigation request will |
115 // be started. | 120 // be started. |
116 void RequestNavigation(FrameTreeNode* frame_tree_node, | 121 void RequestNavigation(FrameTreeNode* frame_tree_node, |
117 const GURL& dest_url, | 122 const GURL& dest_url, |
118 const Referrer& dest_referrer, | 123 const Referrer& dest_referrer, |
119 const FrameNavigationEntry& frame_entry, | 124 const FrameNavigationEntry& frame_entry, |
(...skipping 30 matching lines...) Expand all Loading... | |
150 NavigatorDelegate* delegate_; | 155 NavigatorDelegate* delegate_; |
151 | 156 |
152 std::unique_ptr<NavigatorImpl::NavigationMetricsData> navigation_data_; | 157 std::unique_ptr<NavigatorImpl::NavigationMetricsData> navigation_data_; |
153 | 158 |
154 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 159 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
155 }; | 160 }; |
156 | 161 |
157 } // namespace content | 162 } // namespace content |
158 | 163 |
159 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 164 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
OLD | NEW |