| 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/doomed_resource_handler.h" | 7 #include "content/browser/renderer_host/doomed_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 scoped_ptr<ResourceHandler>(), // handler | 35 scoped_ptr<ResourceHandler>(), // 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 178 } |
| 177 | 179 |
| 178 WebKit::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { | 180 WebKit::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const { |
| 179 return referrer_policy_; | 181 return referrer_policy_; |
| 180 } | 182 } |
| 181 | 183 |
| 182 uint64 ResourceRequestInfoImpl::GetUploadSize() const { | 184 uint64 ResourceRequestInfoImpl::GetUploadSize() const { |
| 183 return upload_size_; | 185 return upload_size_; |
| 184 } | 186 } |
| 185 | 187 |
| 188 bool ResourceRequestInfoImpl::HasUserGesture() const { |
| 189 return has_user_gesture_; |
| 190 } |
| 191 |
| 186 bool ResourceRequestInfoImpl::GetAssociatedRenderView( | 192 bool ResourceRequestInfoImpl::GetAssociatedRenderView( |
| 187 int* render_process_id, | 193 int* render_process_id, |
| 188 int* render_view_id) const { | 194 int* render_view_id) const { |
| 189 // If the request is from the worker process, find a content that owns the | 195 // If the request is from the worker process, find a content that owns the |
| 190 // worker. | 196 // worker. |
| 191 if (process_type_ == PROCESS_TYPE_WORKER) { | 197 if (process_type_ == PROCESS_TYPE_WORKER) { |
| 192 // Need to display some related UI for this network request - pick an | 198 // Need to display some related UI for this network request - pick an |
| 193 // arbitrary parent to do so. | 199 // arbitrary parent to do so. |
| 194 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( | 200 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( |
| 195 child_id_, render_process_id, render_view_id)) { | 201 child_id_, render_process_id, render_view_id)) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 SSLClientAuthHandler* s) { | 235 SSLClientAuthHandler* s) { |
| 230 ssl_client_auth_handler_ = s; | 236 ssl_client_auth_handler_ = s; |
| 231 } | 237 } |
| 232 | 238 |
| 233 void ResourceRequestInfoImpl::set_requested_blob_data( | 239 void ResourceRequestInfoImpl::set_requested_blob_data( |
| 234 webkit_blob::BlobData* data) { | 240 webkit_blob::BlobData* data) { |
| 235 requested_blob_data_ = data; | 241 requested_blob_data_ = data; |
| 236 } | 242 } |
| 237 | 243 |
| 238 } // namespace content | 244 } // namespace content |
| OLD | NEW |