| 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 bool allow_download, | 34 bool allow_download, |
| 35 bool is_async) { | 35 bool is_async) { |
| 36 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the | 36 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the |
| 37 // same time. | 37 // same time. |
| 38 DCHECK(!(is_main_frame && parent_is_main_frame)); | 38 DCHECK(!(is_main_frame && parent_is_main_frame)); |
| 39 | 39 |
| 40 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of | 40 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of |
| 41 // the main frame. | 41 // the main frame. |
| 42 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); | 42 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); |
| 43 | 43 |
| 44 ResourceRequestInfoImpl* info = | 44 ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl( |
| 45 new ResourceRequestInfoImpl( | 45 PROCESS_TYPE_RENDERER, // process_type |
| 46 PROCESS_TYPE_RENDERER, // process_type | 46 render_process_id, // child_id |
| 47 render_process_id, // child_id | 47 render_view_id, // route_id |
| 48 render_view_id, // route_id | 48 -1, // frame_tree_node_id |
| 49 -1, // frame_tree_node_id | 49 0, // origin_pid |
| 50 0, // origin_pid | 50 0, // request_id |
| 51 0, // request_id | 51 render_frame_id, // render_frame_id |
| 52 render_frame_id, // render_frame_id | 52 is_main_frame, // is_main_frame |
| 53 is_main_frame, // is_main_frame | 53 parent_is_main_frame, // parent_is_main_frame |
| 54 parent_is_main_frame, // parent_is_main_frame | 54 0, // parent_render_frame_id |
| 55 0, // parent_render_frame_id | 55 resource_type, // resource_type |
| 56 resource_type, // resource_type | 56 ui::PAGE_TRANSITION_LINK, // transition_type |
| 57 ui::PAGE_TRANSITION_LINK, // transition_type | 57 false, // should_replace_current_entry |
| 58 false, // should_replace_current_entry | 58 false, // is_download |
| 59 false, // is_download | 59 false, // is_stream |
| 60 false, // is_stream | 60 allow_download, // allow_download |
| 61 allow_download, // allow_download | 61 false, // has_user_gesture |
| 62 false, // has_user_gesture | 62 false, // enable load timing |
| 63 false, // enable load timing | 63 request->has_upload(), // enable upload progress |
| 64 request->has_upload(), // enable upload progress | 64 false, // do_not_prompt_for_login |
| 65 false, // do_not_prompt_for_login | 65 blink::WebReferrerPolicyDefault, // referrer_policy |
| 66 blink::WebReferrerPolicyDefault, // referrer_policy | 66 blink::WebPageVisibilityStateVisible, // visibility_state |
| 67 blink::WebPageVisibilityStateVisible, // visibility_state | 67 context, // context |
| 68 context, // context | 68 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 69 base::WeakPtr<ResourceMessageFilter>(), // filter | 69 is_async, // is_async |
| 70 is_async); // is_async | 70 std::string()); // original_headers |
| 71 info->AssociateWithRequest(request); | 71 info->AssociateWithRequest(request); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 bool ResourceRequestInfo::GetRenderFrameForRequest( | 75 bool ResourceRequestInfo::GetRenderFrameForRequest( |
| 76 const net::URLRequest* request, | 76 const net::URLRequest* request, |
| 77 int* render_process_id, | 77 int* render_process_id, |
| 78 int* render_frame_id) { | 78 int* render_frame_id) { |
| 79 URLRequestUserData* user_data = static_cast<URLRequestUserData*>( | 79 URLRequestUserData* user_data = static_cast<URLRequestUserData*>( |
| 80 request->GetUserData(URLRequestUserData::kUserDataKey)); | 80 request->GetUserData(URLRequestUserData::kUserDataKey)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 bool is_stream, | 118 bool is_stream, |
| 119 bool allow_download, | 119 bool allow_download, |
| 120 bool has_user_gesture, | 120 bool has_user_gesture, |
| 121 bool enable_load_timing, | 121 bool enable_load_timing, |
| 122 bool enable_upload_progress, | 122 bool enable_upload_progress, |
| 123 bool do_not_prompt_for_login, | 123 bool do_not_prompt_for_login, |
| 124 blink::WebReferrerPolicy referrer_policy, | 124 blink::WebReferrerPolicy referrer_policy, |
| 125 blink::WebPageVisibilityState visibility_state, | 125 blink::WebPageVisibilityState visibility_state, |
| 126 ResourceContext* context, | 126 ResourceContext* context, |
| 127 base::WeakPtr<ResourceMessageFilter> filter, | 127 base::WeakPtr<ResourceMessageFilter> filter, |
| 128 bool is_async) | 128 bool is_async, |
| 129 const std::string& original_headers) |
| 129 : cross_site_handler_(NULL), | 130 : cross_site_handler_(NULL), |
| 130 detachable_handler_(NULL), | 131 detachable_handler_(NULL), |
| 131 process_type_(process_type), | 132 process_type_(process_type), |
| 132 child_id_(child_id), | 133 child_id_(child_id), |
| 133 route_id_(route_id), | 134 route_id_(route_id), |
| 134 frame_tree_node_id_(frame_tree_node_id), | 135 frame_tree_node_id_(frame_tree_node_id), |
| 135 origin_pid_(origin_pid), | 136 origin_pid_(origin_pid), |
| 136 request_id_(request_id), | 137 request_id_(request_id), |
| 137 render_frame_id_(render_frame_id), | 138 render_frame_id_(render_frame_id), |
| 138 is_main_frame_(is_main_frame), | 139 is_main_frame_(is_main_frame), |
| 139 parent_is_main_frame_(parent_is_main_frame), | 140 parent_is_main_frame_(parent_is_main_frame), |
| 140 parent_render_frame_id_(parent_render_frame_id), | 141 parent_render_frame_id_(parent_render_frame_id), |
| 141 should_replace_current_entry_(should_replace_current_entry), | 142 should_replace_current_entry_(should_replace_current_entry), |
| 142 is_download_(is_download), | 143 is_download_(is_download), |
| 143 is_stream_(is_stream), | 144 is_stream_(is_stream), |
| 144 allow_download_(allow_download), | 145 allow_download_(allow_download), |
| 145 has_user_gesture_(has_user_gesture), | 146 has_user_gesture_(has_user_gesture), |
| 146 enable_load_timing_(enable_load_timing), | 147 enable_load_timing_(enable_load_timing), |
| 147 enable_upload_progress_(enable_upload_progress), | 148 enable_upload_progress_(enable_upload_progress), |
| 148 do_not_prompt_for_login_(do_not_prompt_for_login), | 149 do_not_prompt_for_login_(do_not_prompt_for_login), |
| 149 was_ignored_by_handler_(false), | 150 was_ignored_by_handler_(false), |
| 150 counted_as_in_flight_request_(false), | 151 counted_as_in_flight_request_(false), |
| 151 resource_type_(resource_type), | 152 resource_type_(resource_type), |
| 152 transition_type_(transition_type), | 153 transition_type_(transition_type), |
| 153 memory_cost_(0), | 154 memory_cost_(0), |
| 154 referrer_policy_(referrer_policy), | 155 referrer_policy_(referrer_policy), |
| 155 visibility_state_(visibility_state), | 156 visibility_state_(visibility_state), |
| 156 context_(context), | 157 context_(context), |
| 157 filter_(filter), | 158 filter_(filter), |
| 158 is_async_(is_async) { | 159 is_async_(is_async), |
| 159 } | 160 original_headers_(original_headers) {} |
| 160 | 161 |
| 161 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { | 162 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { |
| 162 } | 163 } |
| 163 | 164 |
| 164 ResourceContext* ResourceRequestInfoImpl::GetContext() const { | 165 ResourceContext* ResourceRequestInfoImpl::GetContext() const { |
| 165 return context_; | 166 return context_; |
| 166 } | 167 } |
| 167 | 168 |
| 168 int ResourceRequestInfoImpl::GetChildID() const { | 169 int ResourceRequestInfoImpl::GetChildID() const { |
| 169 return child_id_; | 170 return child_id_; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 base::WeakPtr<ResourceMessageFilter> filter) { | 276 base::WeakPtr<ResourceMessageFilter> filter) { |
| 276 child_id_ = child_id; | 277 child_id_ = child_id; |
| 277 route_id_ = route_id; | 278 route_id_ = route_id; |
| 278 origin_pid_ = origin_pid; | 279 origin_pid_ = origin_pid; |
| 279 request_id_ = request_id; | 280 request_id_ = request_id; |
| 280 parent_render_frame_id_ = parent_render_frame_id; | 281 parent_render_frame_id_ = parent_render_frame_id; |
| 281 filter_ = filter; | 282 filter_ = filter; |
| 282 } | 283 } |
| 283 | 284 |
| 284 } // namespace content | 285 } // namespace content |
| OLD | NEW |