OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_NAVIGATION_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/browser/frame_host/navigation_entry_impl.h" | 11 #include "content/browser/frame_host/navigation_entry_impl.h" |
12 #include "content/browser/loader/navigation_url_loader_delegate.h" | 12 #include "content/browser/loader/navigation_url_loader_delegate.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/common/frame_message_enums.h" | 14 #include "content/common/frame_message_enums.h" |
15 #include "content/common/navigation_params.h" | 15 #include "content/common/navigation_params.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class FrameTreeNode; | 19 class FrameTreeNode; |
20 class NavigationController; | 20 class NavigationControllerImpl; |
21 class NavigationURLLoader; | 21 class NavigationURLLoader; |
22 class ResourceRequestBody; | 22 class ResourceRequestBody; |
23 class SiteInstanceImpl; | 23 class SiteInstanceImpl; |
24 struct NavigationRequestInfo; | 24 struct NavigationRequestInfo; |
25 | 25 |
26 // PlzNavigate | 26 // PlzNavigate |
27 // A UI thread object that owns a navigation request until it commits. It | 27 // A UI thread object that owns a navigation request until it commits. It |
28 // ensures the UI thread can start a navigation request in the | 28 // ensures the UI thread can start a navigation request in the |
29 // ResourceDispatcherHost (that lives on the IO thread). | 29 // ResourceDispatcherHost (that lives on the IO thread). |
30 // TODO(clamy): Describe the interactions between the UI and IO thread during | 30 // TODO(clamy): Describe the interactions between the UI and IO thread during |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Called on the UI thread by the Navigator to start the navigation. Returns | 81 // Called on the UI thread by the Navigator to start the navigation. Returns |
82 // whether a request was made on the IO thread. | 82 // whether a request was made on the IO thread. |
83 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid | 83 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid |
84 // threading subtleties. | 84 // threading subtleties. |
85 bool BeginNavigation(); | 85 bool BeginNavigation(); |
86 | 86 |
87 const CommonNavigationParams& common_params() const { return common_params_; } | 87 const CommonNavigationParams& common_params() const { return common_params_; } |
88 | 88 |
89 const BeginNavigationParams& begin_params() const { return begin_params_; } | 89 const BeginNavigationParams& begin_params() const { return begin_params_; } |
90 | 90 |
91 const CommitNavigationParams& commit_params() const { return commit_params_; } | 91 const RequestNavigationParams& request_params() const { |
92 | 92 return request_params_; |
93 const HistoryNavigationParams& history_params() const { | |
94 return history_params_; | |
95 } | 93 } |
96 | 94 |
97 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } | 95 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } |
98 | 96 |
99 NavigationState state() const { return state_; } | 97 NavigationState state() const { return state_; } |
100 | 98 |
101 SiteInstanceImpl* source_site_instance() const { | 99 SiteInstanceImpl* source_site_instance() const { |
102 return source_site_instance_.get(); | 100 return source_site_instance_.get(); |
103 } | 101 } |
104 | 102 |
(...skipping 13 matching lines...) Expand all Loading... |
118 | 116 |
119 void SetWaitingForRendererResponse() { | 117 void SetWaitingForRendererResponse() { |
120 DCHECK(state_ == NOT_STARTED); | 118 DCHECK(state_ == NOT_STARTED); |
121 state_ = WAITING_FOR_RENDERER_RESPONSE; | 119 state_ = WAITING_FOR_RENDERER_RESPONSE; |
122 } | 120 } |
123 | 121 |
124 private: | 122 private: |
125 NavigationRequest(FrameTreeNode* frame_tree_node, | 123 NavigationRequest(FrameTreeNode* frame_tree_node, |
126 const CommonNavigationParams& common_params, | 124 const CommonNavigationParams& common_params, |
127 const BeginNavigationParams& begin_params, | 125 const BeginNavigationParams& begin_params, |
128 const CommitNavigationParams& commit_params, | 126 const RequestNavigationParams& request_params, |
129 const HistoryNavigationParams& history_params, | |
130 scoped_refptr<ResourceRequestBody> body, | 127 scoped_refptr<ResourceRequestBody> body, |
131 bool browser_initiated, | 128 bool browser_initiated, |
132 const NavigationEntryImpl* navitation_entry); | 129 const NavigationEntryImpl* navitation_entry); |
133 | 130 |
134 // NavigationURLLoaderDelegate implementation. | 131 // NavigationURLLoaderDelegate implementation. |
135 void OnRequestRedirected( | 132 void OnRequestRedirected( |
136 const net::RedirectInfo& redirect_info, | 133 const net::RedirectInfo& redirect_info, |
137 const scoped_refptr<ResourceResponse>& response) override; | 134 const scoped_refptr<ResourceResponse>& response) override; |
138 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, | 135 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, |
139 scoped_ptr<StreamHandle> body) override; | 136 scoped_ptr<StreamHandle> body) override; |
140 void OnRequestFailed(int net_error) override; | 137 void OnRequestFailed(int net_error) override; |
141 void OnRequestStarted(base::TimeTicks timestamp) override; | 138 void OnRequestStarted(base::TimeTicks timestamp) override; |
142 | 139 |
143 FrameTreeNode* frame_tree_node_; | 140 FrameTreeNode* frame_tree_node_; |
144 | 141 |
145 // Initialized on creation of the NavigationRequest. Sent to the renderer when | 142 // Initialized on creation of the NavigationRequest. Sent to the renderer when |
146 // the navigation is ready to commit. | 143 // the navigation is ready to commit. |
147 // Note: When the navigation is ready to commit, the url in |common_params| | 144 // Note: When the navigation is ready to commit, the url in |common_params| |
148 // will be set to the final navigation url, obtained after following all | 145 // will be set to the final navigation url, obtained after following all |
149 // redirects. | 146 // redirects. |
150 CommonNavigationParams common_params_; | 147 CommonNavigationParams common_params_; |
151 const BeginNavigationParams begin_params_; | 148 const BeginNavigationParams begin_params_; |
152 const CommitNavigationParams commit_params_; | 149 const RequestNavigationParams request_params_; |
153 const HistoryNavigationParams history_params_; | |
154 const bool browser_initiated_; | 150 const bool browser_initiated_; |
155 | 151 |
156 NavigationState state_; | 152 NavigationState state_; |
157 | 153 |
158 | 154 |
159 // The parameters to send to the IO thread. |loader_| takes ownership of | 155 // The parameters to send to the IO thread. |loader_| takes ownership of |
160 // |info_| after calling BeginNavigation. | 156 // |info_| after calling BeginNavigation. |
161 scoped_ptr<NavigationRequestInfo> info_; | 157 scoped_ptr<NavigationRequestInfo> info_; |
162 | 158 |
163 scoped_ptr<NavigationURLLoader> loader_; | 159 scoped_ptr<NavigationURLLoader> loader_; |
164 | 160 |
165 // These next items are used in browser-initiated navigations to store | 161 // These next items are used in browser-initiated navigations to store |
166 // information from the NavigationEntryImpl that is required after request | 162 // information from the NavigationEntryImpl that is required after request |
167 // creation time. | 163 // creation time. |
168 scoped_refptr<SiteInstanceImpl> source_site_instance_; | 164 scoped_refptr<SiteInstanceImpl> source_site_instance_; |
169 scoped_refptr<SiteInstanceImpl> dest_site_instance_; | 165 scoped_refptr<SiteInstanceImpl> dest_site_instance_; |
170 NavigationEntryImpl::RestoreType restore_type_; | 166 NavigationEntryImpl::RestoreType restore_type_; |
171 bool is_view_source_; | 167 bool is_view_source_; |
172 int bindings_; | 168 int bindings_; |
173 | 169 |
174 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); | 170 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); |
175 }; | 171 }; |
176 | 172 |
177 } // namespace content | 173 } // namespace content |
178 | 174 |
179 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 175 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
OLD | NEW |