OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/public/browser/resource_request_info.h" | 16 #include "content/public/browser/resource_request_info.h" |
17 #include "content/public/common/referrer.h" | 17 #include "content/public/common/referrer.h" |
18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
19 #include "net/base/load_states.h" | 19 #include "net/base/load_states.h" |
20 | 20 |
21 struct ResourceHostMsg_Request; | |
22 | |
21 namespace content { | 23 namespace content { |
22 class CrossSiteResourceHandler; | 24 class CrossSiteResourceHandler; |
23 class DetachableResourceHandler; | 25 class DetachableResourceHandler; |
24 class ResourceContext; | 26 class ResourceContext; |
25 class ResourceMessageFilter; | 27 class ResourceMessageFilter; |
26 struct GlobalRequestID; | 28 struct GlobalRequestID; |
27 struct GlobalRoutingID; | 29 struct GlobalRoutingID; |
28 | 30 |
29 // Holds the data ResourceDispatcherHost associates with each request. | 31 // Holds the data ResourceDispatcherHost associates with each request. |
30 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. | 32 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. |
31 class ResourceRequestInfoImpl : public ResourceRequestInfo, | 33 class ResourceRequestInfoImpl : public ResourceRequestInfo, |
32 public base::SupportsUserData::Data { | 34 public base::SupportsUserData::Data { |
33 public: | 35 public: |
34 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. | 36 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. |
35 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( | 37 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( |
36 net::URLRequest* request); | 38 net::URLRequest* request); |
37 | 39 |
38 // And, a const version for cases where you only need read access. | 40 // And, a const version for cases where you only need read access. |
39 CONTENT_EXPORT static const ResourceRequestInfoImpl* ForRequest( | 41 CONTENT_EXPORT static const ResourceRequestInfoImpl* ForRequest( |
40 const net::URLRequest* request); | 42 const net::URLRequest* request); |
41 | 43 |
44 // TODO(ricea): Something about this constructor. | |
davidben
2015/10/08 21:57:52
?
Adam Rice
2015/10/13 22:53:17
I feel that 26 arguments is excessive. TODO remove
| |
45 // |original_request| is owned by the caller. If non-NULL, it is copied by | |
46 // the constructor. | |
42 CONTENT_EXPORT ResourceRequestInfoImpl( | 47 CONTENT_EXPORT ResourceRequestInfoImpl( |
43 int process_type, | 48 int process_type, |
44 int child_id, | 49 int child_id, |
45 int route_id, | 50 int route_id, |
46 int frame_tree_node_id, | 51 int frame_tree_node_id, |
47 int origin_pid, | 52 int origin_pid, |
48 int request_id, | 53 int request_id, |
49 int render_frame_id, | 54 int render_frame_id, |
50 bool is_main_frame, | 55 bool is_main_frame, |
51 bool parent_is_main_frame, | 56 bool parent_is_main_frame, |
52 int parent_render_frame_id, | 57 int parent_render_frame_id, |
53 ResourceType resource_type, | 58 ResourceType resource_type, |
54 ui::PageTransition transition_type, | 59 ui::PageTransition transition_type, |
55 bool should_replace_current_entry, | 60 bool should_replace_current_entry, |
56 bool is_download, | 61 bool is_download, |
57 bool is_stream, | 62 bool is_stream, |
58 bool allow_download, | 63 bool allow_download, |
59 bool has_user_gesture, | 64 bool has_user_gesture, |
60 bool enable_load_timing, | 65 bool enable_load_timing, |
61 bool enable_upload_progress, | 66 bool enable_upload_progress, |
62 bool do_not_prompt_for_login, | 67 bool do_not_prompt_for_login, |
63 blink::WebReferrerPolicy referrer_policy, | 68 blink::WebReferrerPolicy referrer_policy, |
64 blink::WebPageVisibilityState visibility_state, | 69 blink::WebPageVisibilityState visibility_state, |
65 ResourceContext* context, | 70 ResourceContext* context, |
66 base::WeakPtr<ResourceMessageFilter> filter, | 71 base::WeakPtr<ResourceMessageFilter> filter, |
67 bool is_async); | 72 bool is_async, |
73 const ResourceHostMsg_Request* original_request); | |
68 ~ResourceRequestInfoImpl() override; | 74 ~ResourceRequestInfoImpl() override; |
69 | 75 |
70 // ResourceRequestInfo implementation: | 76 // ResourceRequestInfo implementation: |
71 ResourceContext* GetContext() const override; | 77 ResourceContext* GetContext() const override; |
72 int GetChildID() const override; | 78 int GetChildID() const override; |
73 int GetRouteID() const override; | 79 int GetRouteID() const override; |
74 int GetOriginPID() const override; | 80 int GetOriginPID() const override; |
75 int GetRequestID() const override; | 81 int GetRequestID() const override; |
76 int GetRenderFrameID() const override; | 82 int GetRenderFrameID() const override; |
77 bool IsMainFrame() const override; | 83 bool IsMainFrame() const override; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 void set_memory_cost(int cost) { memory_cost_ = cost; } | 177 void set_memory_cost(int cost) { memory_cost_ = cost; } |
172 | 178 |
173 bool is_load_timing_enabled() const { return enable_load_timing_; } | 179 bool is_load_timing_enabled() const { return enable_load_timing_; } |
174 | 180 |
175 bool is_upload_progress_enabled() const { return enable_upload_progress_; } | 181 bool is_upload_progress_enabled() const { return enable_upload_progress_; } |
176 | 182 |
177 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 183 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } |
178 void set_do_not_prompt_for_login(bool do_not_prompt) { | 184 void set_do_not_prompt_for_login(bool do_not_prompt) { |
179 do_not_prompt_for_login_ = do_not_prompt; | 185 do_not_prompt_for_login_ = do_not_prompt; |
180 } | 186 } |
187 ResourceHostMsg_Request* original_request() { | |
188 return original_request_.get(); | |
189 } | |
181 | 190 |
182 private: | 191 private: |
183 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 192 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
184 DeletedFilterDetached); | 193 DeletedFilterDetached); |
185 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 194 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
186 DeletedFilterDetachedRedirect); | 195 DeletedFilterDetachedRedirect); |
187 // Non-owning, may be NULL. | 196 // Non-owning, may be NULL. |
188 CrossSiteResourceHandler* cross_site_handler_; | 197 CrossSiteResourceHandler* cross_site_handler_; |
189 DetachableResourceHandler* detachable_handler_; | 198 DetachableResourceHandler* detachable_handler_; |
190 | 199 |
(...skipping 19 matching lines...) Expand all Loading... | |
210 bool counted_as_in_flight_request_; | 219 bool counted_as_in_flight_request_; |
211 ResourceType resource_type_; | 220 ResourceType resource_type_; |
212 ui::PageTransition transition_type_; | 221 ui::PageTransition transition_type_; |
213 int memory_cost_; | 222 int memory_cost_; |
214 blink::WebReferrerPolicy referrer_policy_; | 223 blink::WebReferrerPolicy referrer_policy_; |
215 blink::WebPageVisibilityState visibility_state_; | 224 blink::WebPageVisibilityState visibility_state_; |
216 ResourceContext* context_; | 225 ResourceContext* context_; |
217 // The filter might be deleted without deleting this object if the process | 226 // The filter might be deleted without deleting this object if the process |
218 // exits during a transfer. | 227 // exits during a transfer. |
219 base::WeakPtr<ResourceMessageFilter> filter_; | 228 base::WeakPtr<ResourceMessageFilter> filter_; |
229 | |
230 // Original request information required to clone the request if an async | |
davidben
2015/10/08 21:57:52
See comment in the RDH re how to avoid this.
Adam Rice
2015/10/13 22:53:17
I'm sorry, I can't find the comment that you are r
| |
231 // revalidation will be performed. NULL if async revalidation is not | |
davidben
2015/10/08 21:57:52
nullptr
Adam Rice
2015/10/13 22:53:17
Done.
| |
232 // applicable to this request (eg. it is already an async revalidation, is not | |
233 // method "GET", etc.). | |
234 scoped_ptr<ResourceHostMsg_Request> original_request_; | |
235 | |
220 bool is_async_; | 236 bool is_async_; |
221 | 237 |
222 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); | 238 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); |
223 }; | 239 }; |
224 | 240 |
225 } // namespace content | 241 } // namespace content |
226 | 242 |
227 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 243 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
OLD | NEW |