Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: content/browser/frame_host/navigation_request.h

Issue 1018383002: Make NavigationParams clearer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 CommitNavigationParams& commit_params() const { return commit_params_; }
92 92
93 const HistoryNavigationParams& history_params() const {
94 return history_params_;
95 }
96
97 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } 93 NavigationURLLoader* loader_for_testing() const { return loader_.get(); }
98 94
99 NavigationState state() const { return state_; } 95 NavigationState state() const { return state_; }
100 96
101 SiteInstanceImpl* source_site_instance() const { 97 SiteInstanceImpl* source_site_instance() const {
102 return source_site_instance_.get(); 98 return source_site_instance_.get();
103 } 99 }
104 100
105 SiteInstanceImpl* dest_site_instance() const { 101 SiteInstanceImpl* dest_site_instance() const {
106 return dest_site_instance_.get(); 102 return dest_site_instance_.get();
(...skipping 12 matching lines...) Expand all
119 void SetWaitingForRendererResponse() { 115 void SetWaitingForRendererResponse() {
120 DCHECK(state_ == NOT_STARTED); 116 DCHECK(state_ == NOT_STARTED);
121 state_ = WAITING_FOR_RENDERER_RESPONSE; 117 state_ = WAITING_FOR_RENDERER_RESPONSE;
122 } 118 }
123 119
124 private: 120 private:
125 NavigationRequest(FrameTreeNode* frame_tree_node, 121 NavigationRequest(FrameTreeNode* frame_tree_node,
126 const CommonNavigationParams& common_params, 122 const CommonNavigationParams& common_params,
127 const BeginNavigationParams& begin_params, 123 const BeginNavigationParams& begin_params,
128 const CommitNavigationParams& commit_params, 124 const CommitNavigationParams& commit_params,
129 const HistoryNavigationParams& history_params,
130 scoped_refptr<ResourceRequestBody> body, 125 scoped_refptr<ResourceRequestBody> body,
131 bool browser_initiated, 126 bool browser_initiated,
132 const NavigationEntryImpl* navitation_entry); 127 const NavigationEntryImpl* navitation_entry);
133 128
134 // NavigationURLLoaderDelegate implementation. 129 // NavigationURLLoaderDelegate implementation.
135 void OnRequestRedirected( 130 void OnRequestRedirected(
136 const net::RedirectInfo& redirect_info, 131 const net::RedirectInfo& redirect_info,
137 const scoped_refptr<ResourceResponse>& response) override; 132 const scoped_refptr<ResourceResponse>& response) override;
138 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, 133 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response,
139 scoped_ptr<StreamHandle> body) override; 134 scoped_ptr<StreamHandle> body) override;
140 void OnRequestFailed(int net_error) override; 135 void OnRequestFailed(int net_error) override;
141 void OnRequestStarted(base::TimeTicks timestamp) override; 136 void OnRequestStarted(base::TimeTicks timestamp) override;
142 137
143 FrameTreeNode* frame_tree_node_; 138 FrameTreeNode* frame_tree_node_;
144 139
145 // Initialized on creation of the NavigationRequest. Sent to the renderer when 140 // Initialized on creation of the NavigationRequest. Sent to the renderer when
146 // the navigation is ready to commit. 141 // the navigation is ready to commit.
147 // Note: When the navigation is ready to commit, the url in |common_params| 142 // 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 143 // will be set to the final navigation url, obtained after following all
149 // redirects. 144 // redirects.
150 CommonNavigationParams common_params_; 145 CommonNavigationParams common_params_;
151 const BeginNavigationParams begin_params_; 146 const BeginNavigationParams begin_params_;
152 const CommitNavigationParams commit_params_; 147 const CommitNavigationParams commit_params_;
153 const HistoryNavigationParams history_params_;
154 const bool browser_initiated_; 148 const bool browser_initiated_;
155 149
156 NavigationState state_; 150 NavigationState state_;
157 151
158 152
159 // The parameters to send to the IO thread. |loader_| takes ownership of 153 // The parameters to send to the IO thread. |loader_| takes ownership of
160 // |info_| after calling BeginNavigation. 154 // |info_| after calling BeginNavigation.
161 scoped_ptr<NavigationRequestInfo> info_; 155 scoped_ptr<NavigationRequestInfo> info_;
162 156
163 scoped_ptr<NavigationURLLoader> loader_; 157 scoped_ptr<NavigationURLLoader> loader_;
164 158
165 // These next items are used in browser-initiated navigations to store 159 // These next items are used in browser-initiated navigations to store
166 // information from the NavigationEntryImpl that is required after request 160 // information from the NavigationEntryImpl that is required after request
167 // creation time. 161 // creation time.
168 scoped_refptr<SiteInstanceImpl> source_site_instance_; 162 scoped_refptr<SiteInstanceImpl> source_site_instance_;
169 scoped_refptr<SiteInstanceImpl> dest_site_instance_; 163 scoped_refptr<SiteInstanceImpl> dest_site_instance_;
170 NavigationEntryImpl::RestoreType restore_type_; 164 NavigationEntryImpl::RestoreType restore_type_;
171 bool is_view_source_; 165 bool is_view_source_;
172 int bindings_; 166 int bindings_;
173 167
174 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); 168 DISALLOW_COPY_AND_ASSIGN(NavigationRequest);
175 }; 169 };
176 170
177 } // namespace content 171 } // namespace content
178 172
179 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 173 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698