| 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 #include "content/browser/loader/resource_request_info_impl.h" | 5 #include "content/browser/loader/resource_request_info_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/loader/global_routing_id.h" | 7 #include "content/browser/loader/global_routing_id.h" |
| 8 #include "content/browser/loader/resource_message_filter.h" | 8 #include "content/browser/loader/resource_message_filter.h" |
| 9 #include "content/common/net/url_request_user_data.h" | 9 #include "content/common/net/url_request_user_data.h" |
| 10 #include "content/public/browser/global_request_id.h" | 10 #include "content/public/browser/global_request_id.h" |
| 11 #include "content/public/common/process_type.h" | 11 #include "content/public/common/process_type.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // ---------------------------------------------------------------------------- | 16 // ---------------------------------------------------------------------------- |
| 17 // ResourceRequestInfo | 17 // ResourceRequestInfo |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( | 20 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( |
| 21 const net::URLRequest* request) { | 21 const net::URLRequest* request) { |
| 22 return ResourceRequestInfoImpl::ForRequest(request); | 22 return ResourceRequestInfoImpl::ForRequest(request); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 void ResourceRequestInfo::AllocateForTesting( | 26 void ResourceRequestInfo::AllocateForTesting(net::URLRequest* request, |
| 27 net::URLRequest* request, | 27 ResourceType resource_type, |
| 28 ResourceType::Type resource_type, | 28 ResourceContext* context, |
| 29 ResourceContext* context, | 29 int render_process_id, |
| 30 int render_process_id, | 30 int render_view_id, |
| 31 int render_view_id, | 31 int render_frame_id, |
| 32 int render_frame_id, | 32 bool is_async) { |
| 33 bool is_async) { | |
| 34 ResourceRequestInfoImpl* info = | 33 ResourceRequestInfoImpl* info = |
| 35 new ResourceRequestInfoImpl( | 34 new ResourceRequestInfoImpl( |
| 36 PROCESS_TYPE_RENDERER, // process_type | 35 PROCESS_TYPE_RENDERER, // process_type |
| 37 render_process_id, // child_id | 36 render_process_id, // child_id |
| 38 render_view_id, // route_id | 37 render_view_id, // route_id |
| 39 0, // origin_pid | 38 0, // origin_pid |
| 40 0, // request_id | 39 0, // request_id |
| 41 render_frame_id, // render_frame_id | 40 render_frame_id, // render_frame_id |
| 42 resource_type == ResourceType::MAIN_FRAME, // is_main_frame | 41 resource_type == RESOURCE_TYPE_MAIN_FRAME, // is_main_frame |
| 43 false, // parent_is_main_frame | 42 false, // parent_is_main_frame |
| 44 0, // parent_render_frame_id | 43 0, // parent_render_frame_id |
| 45 resource_type, // resource_type | 44 resource_type, // resource_type |
| 46 PAGE_TRANSITION_LINK, // transition_type | 45 PAGE_TRANSITION_LINK, // transition_type |
| 47 false, // should_replace_current_entry | 46 false, // should_replace_current_entry |
| 48 false, // is_download | 47 false, // is_download |
| 49 false, // is_stream | 48 false, // is_stream |
| 50 true, // allow_download | 49 true, // allow_download |
| 51 false, // has_user_gesture | 50 false, // has_user_gesture |
| 52 blink::WebReferrerPolicyDefault, // referrer_policy | 51 blink::WebReferrerPolicyDefault, // referrer_policy |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ResourceRequestInfoImpl::ResourceRequestInfoImpl( | 88 ResourceRequestInfoImpl::ResourceRequestInfoImpl( |
| 90 int process_type, | 89 int process_type, |
| 91 int child_id, | 90 int child_id, |
| 92 int route_id, | 91 int route_id, |
| 93 int origin_pid, | 92 int origin_pid, |
| 94 int request_id, | 93 int request_id, |
| 95 int render_frame_id, | 94 int render_frame_id, |
| 96 bool is_main_frame, | 95 bool is_main_frame, |
| 97 bool parent_is_main_frame, | 96 bool parent_is_main_frame, |
| 98 int parent_render_frame_id, | 97 int parent_render_frame_id, |
| 99 ResourceType::Type resource_type, | 98 ResourceType resource_type, |
| 100 PageTransition transition_type, | 99 PageTransition transition_type, |
| 101 bool should_replace_current_entry, | 100 bool should_replace_current_entry, |
| 102 bool is_download, | 101 bool is_download, |
| 103 bool is_stream, | 102 bool is_stream, |
| 104 bool allow_download, | 103 bool allow_download, |
| 105 bool has_user_gesture, | 104 bool has_user_gesture, |
| 106 blink::WebReferrerPolicy referrer_policy, | 105 blink::WebReferrerPolicy referrer_policy, |
| 107 blink::WebPageVisibilityState visibility_state, | 106 blink::WebPageVisibilityState visibility_state, |
| 108 ResourceContext* context, | 107 ResourceContext* context, |
| 109 base::WeakPtr<ResourceMessageFilter> filter, | 108 base::WeakPtr<ResourceMessageFilter> filter, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 166 } |
| 168 | 167 |
| 169 bool ResourceRequestInfoImpl::ParentIsMainFrame() const { | 168 bool ResourceRequestInfoImpl::ParentIsMainFrame() const { |
| 170 return parent_is_main_frame_; | 169 return parent_is_main_frame_; |
| 171 } | 170 } |
| 172 | 171 |
| 173 int ResourceRequestInfoImpl::GetParentRenderFrameID() const { | 172 int ResourceRequestInfoImpl::GetParentRenderFrameID() const { |
| 174 return parent_render_frame_id_; | 173 return parent_render_frame_id_; |
| 175 } | 174 } |
| 176 | 175 |
| 177 ResourceType::Type ResourceRequestInfoImpl::GetResourceType() const { | 176 ResourceType ResourceRequestInfoImpl::GetResourceType() const { |
| 178 return resource_type_; | 177 return resource_type_; |
| 179 } | 178 } |
| 180 | 179 |
| 181 int ResourceRequestInfoImpl::GetProcessType() const { | 180 int ResourceRequestInfoImpl::GetProcessType() const { |
| 182 return process_type_; | 181 return process_type_; |
| 183 } | 182 } |
| 184 | 183 |
| 185 blink::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { | 184 blink::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { |
| 186 return referrer_policy_; | 185 return referrer_policy_; |
| 187 } | 186 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 base::WeakPtr<ResourceMessageFilter> filter) { | 251 base::WeakPtr<ResourceMessageFilter> filter) { |
| 253 child_id_ = child_id; | 252 child_id_ = child_id; |
| 254 route_id_ = route_id; | 253 route_id_ = route_id; |
| 255 origin_pid_ = origin_pid; | 254 origin_pid_ = origin_pid; |
| 256 request_id_ = request_id; | 255 request_id_ = request_id; |
| 257 parent_render_frame_id_ = parent_render_frame_id; | 256 parent_render_frame_id_ = parent_render_frame_id; |
| 258 filter_ = filter; | 257 filter_ = filter; |
| 259 } | 258 } |
| 260 | 259 |
| 261 } // namespace content | 260 } // namespace content |
| OLD | NEW |