| 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/renderer_host/resource_request_info_impl.h" | 5 #include "content/browser/renderer_host/resource_request_info_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/resource_handler.h" | 7 #include "content/browser/renderer_host/resource_handler.h" |
| 8 #include "content/browser/ssl/ssl_client_auth_handler.h" | 8 #include "content/browser/ssl/ssl_client_auth_handler.h" |
| 9 #include "content/browser/worker_host/worker_service_impl.h" | 9 #include "content/browser/worker_host/worker_service_impl.h" |
| 10 #include "content/common/net/url_request_user_data.h" | 10 #include "content/common/net/url_request_user_data.h" |
| 11 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 11 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 #include "webkit/blob/blob_data.h" | 13 #include "webkit/blob/blob_data.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // ---------------------------------------------------------------------------- | 17 // ---------------------------------------------------------------------------- |
| 18 // ResourceRequestInfo | 18 // ResourceRequestInfo |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( | 21 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( |
| 22 const net::URLRequest* request) { | 22 const net::URLRequest* request) { |
| 23 return ResourceRequestInfoImpl::ForRequest(request); | 23 return ResourceRequestInfoImpl::ForRequest(request); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 void ResourceRequestInfo::AllocateForTesting( | 27 void ResourceRequestInfo::AllocateForTesting( |
| 28 net::URLRequest* request, | 28 net::URLRequest* request, |
| 29 ResourceType::Type resource_type, | 29 ResourceType::Type resource_type, |
| 30 ResourceContext* context) { | 30 ResourceContext* context, |
| 31 int render_process_id, |
| 32 int render_view_id) { |
| 31 ResourceRequestInfoImpl* info = | 33 ResourceRequestInfoImpl* info = |
| 32 new ResourceRequestInfoImpl( | 34 new ResourceRequestInfoImpl( |
| 33 NULL, // handler | 35 NULL, // handler |
| 34 PROCESS_TYPE_RENDERER, // process_type | 36 PROCESS_TYPE_RENDERER, // process_type |
| 35 -1, // child_id | 37 render_process_id, // child_id |
| 36 MSG_ROUTING_NONE, // route_id | 38 render_view_id, // route_id |
| 37 0, // origin_pid | 39 0, // origin_pid |
| 38 0, // request_id | 40 0, // request_id |
| 39 resource_type == ResourceType::MAIN_FRAME, // is_main_frame | 41 resource_type == ResourceType::MAIN_FRAME, // is_main_frame |
| 40 0, // frame_id | 42 0, // frame_id |
| 41 false, // parent_is_main_frame | 43 false, // parent_is_main_frame |
| 42 0, // parent_frame_id | 44 0, // parent_frame_id |
| 43 resource_type, // resource_type | 45 resource_type, // resource_type |
| 44 PAGE_TRANSITION_LINK, // transition_type | 46 PAGE_TRANSITION_LINK, // transition_type |
| 45 0, // upload_size | 47 0, // upload_size |
| 46 false, // is_download | 48 false, // is_download |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 177 } |
| 176 | 178 |
| 177 WebKit::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { | 179 WebKit::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { |
| 178 return referrer_policy_; | 180 return referrer_policy_; |
| 179 } | 181 } |
| 180 | 182 |
| 181 uint64 ResourceRequestInfoImpl::GetUploadSize() const { | 183 uint64 ResourceRequestInfoImpl::GetUploadSize() const { |
| 182 return upload_size_; | 184 return upload_size_; |
| 183 } | 185 } |
| 184 | 186 |
| 187 bool ResourceRequestInfoImpl::HasUserGesture() const { |
| 188 return has_user_gesture_; |
| 189 } |
| 190 |
| 185 bool ResourceRequestInfoImpl::GetAssociatedRenderView( | 191 bool ResourceRequestInfoImpl::GetAssociatedRenderView( |
| 186 int* render_process_id, | 192 int* render_process_id, |
| 187 int* render_view_id) const { | 193 int* render_view_id) const { |
| 188 // If the request is from the worker process, find a content that owns the | 194 // If the request is from the worker process, find a content that owns the |
| 189 // worker. | 195 // worker. |
| 190 if (process_type_ == PROCESS_TYPE_WORKER) { | 196 if (process_type_ == PROCESS_TYPE_WORKER) { |
| 191 // Need to display some related UI for this network request - pick an | 197 // Need to display some related UI for this network request - pick an |
| 192 // arbitrary parent to do so. | 198 // arbitrary parent to do so. |
| 193 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( | 199 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( |
| 194 child_id_, render_process_id, render_view_id)) { | 200 child_id_, render_process_id, render_view_id)) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 SSLClientAuthHandler* s) { | 234 SSLClientAuthHandler* s) { |
| 229 ssl_client_auth_handler_ = s; | 235 ssl_client_auth_handler_ = s; |
| 230 } | 236 } |
| 231 | 237 |
| 232 void ResourceRequestInfoImpl::set_requested_blob_data( | 238 void ResourceRequestInfoImpl::set_requested_blob_data( |
| 233 webkit_blob::BlobData* data) { | 239 webkit_blob::BlobData* data) { |
| 234 requested_blob_data_ = data; | 240 requested_blob_data_ = data; |
| 235 } | 241 } |
| 236 | 242 |
| 237 } // namespace content | 243 } // namespace content |
| OLD | NEW |