Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/browser/renderer_host/resource_request_info_impl.cc

Issue 10501004: Refactor the guts of ResourceDispatcherHostImpl into a new class named (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #include "content/browser/ssl/ssl_client_auth_handler.h"
9 #include "content/browser/worker_host/worker_service_impl.h" 7 #include "content/browser/worker_host/worker_service_impl.h"
10 #include "content/common/net/url_request_user_data.h" 8 #include "content/common/net/url_request_user_data.h"
11 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" 9 #include "content/public/browser/global_request_id.h"
12 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
13 #include "webkit/blob/blob_data.h" 11 #include "webkit/blob/blob_data.h"
14 12
15 namespace content { 13 namespace content {
16 14
17 // ---------------------------------------------------------------------------- 15 // ----------------------------------------------------------------------------
18 // ResourceRequestInfo 16 // ResourceRequestInfo
19 17
20 // static 18 // static
21 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( 19 const ResourceRequestInfo* ResourceRequestInfo::ForRequest(
22 const net::URLRequest* request) { 20 const net::URLRequest* request) {
23 return ResourceRequestInfoImpl::ForRequest(request); 21 return ResourceRequestInfoImpl::ForRequest(request);
24 } 22 }
25 23
26 // static 24 // static
27 void ResourceRequestInfo::AllocateForTesting( 25 void ResourceRequestInfo::AllocateForTesting(
28 net::URLRequest* request, 26 net::URLRequest* request,
29 ResourceType::Type resource_type, 27 ResourceType::Type resource_type,
30 ResourceContext* context) { 28 ResourceContext* context) {
31 ResourceRequestInfoImpl* info = 29 ResourceRequestInfoImpl* info =
32 new ResourceRequestInfoImpl( 30 new ResourceRequestInfoImpl(
33 scoped_ptr<ResourceHandler>(), // handler
34 PROCESS_TYPE_RENDERER, // process_type 31 PROCESS_TYPE_RENDERER, // process_type
35 -1, // child_id 32 -1, // child_id
36 MSG_ROUTING_NONE, // route_id 33 MSG_ROUTING_NONE, // route_id
37 0, // origin_pid 34 0, // origin_pid
38 0, // request_id 35 0, // request_id
39 resource_type == ResourceType::MAIN_FRAME, // is_main_frame 36 resource_type == ResourceType::MAIN_FRAME, // is_main_frame
40 0, // frame_id 37 0, // frame_id
41 false, // parent_is_main_frame 38 false, // parent_is_main_frame
42 0, // parent_frame_id 39 0, // parent_frame_id
43 resource_type, // resource_type 40 resource_type, // resource_type
(...skipping 30 matching lines...) Expand all
74 return static_cast<ResourceRequestInfoImpl*>(request->GetUserData(NULL)); 71 return static_cast<ResourceRequestInfoImpl*>(request->GetUserData(NULL));
75 } 72 }
76 73
77 // static 74 // static
78 const ResourceRequestInfoImpl* ResourceRequestInfoImpl::ForRequest( 75 const ResourceRequestInfoImpl* ResourceRequestInfoImpl::ForRequest(
79 const net::URLRequest* request) { 76 const net::URLRequest* request) {
80 return ForRequest(const_cast<net::URLRequest*>(request)); 77 return ForRequest(const_cast<net::URLRequest*>(request));
81 } 78 }
82 79
83 ResourceRequestInfoImpl::ResourceRequestInfoImpl( 80 ResourceRequestInfoImpl::ResourceRequestInfoImpl(
84 scoped_ptr<ResourceHandler> handler,
85 ProcessType process_type, 81 ProcessType process_type,
86 int child_id, 82 int child_id,
87 int route_id, 83 int route_id,
88 int origin_pid, 84 int origin_pid,
89 int request_id, 85 int request_id,
90 bool is_main_frame, 86 bool is_main_frame,
91 int64 frame_id, 87 int64 frame_id,
92 bool parent_is_main_frame, 88 bool parent_is_main_frame,
93 int64 parent_frame_id, 89 int64 parent_frame_id,
94 ResourceType::Type resource_type, 90 ResourceType::Type resource_type,
95 PageTransition transition_type, 91 PageTransition transition_type,
96 uint64 upload_size, 92 uint64 upload_size,
97 bool is_download, 93 bool is_download,
98 bool allow_download, 94 bool allow_download,
99 bool has_user_gesture, 95 bool has_user_gesture,
100 WebKit::WebReferrerPolicy referrer_policy, 96 WebKit::WebReferrerPolicy referrer_policy,
101 ResourceContext* context) 97 ResourceContext* context)
102 : resource_handler_(handler.Pass()), 98 : cross_site_handler_(NULL),
103 cross_site_handler_(NULL),
104 process_type_(process_type), 99 process_type_(process_type),
105 child_id_(child_id), 100 child_id_(child_id),
106 route_id_(route_id), 101 route_id_(route_id),
107 origin_pid_(origin_pid), 102 origin_pid_(origin_pid),
108 request_id_(request_id), 103 request_id_(request_id),
109 is_main_frame_(is_main_frame), 104 is_main_frame_(is_main_frame),
110 frame_id_(frame_id), 105 frame_id_(frame_id),
111 parent_is_main_frame_(parent_is_main_frame), 106 parent_is_main_frame_(parent_is_main_frame),
112 parent_frame_id_(parent_frame_id), 107 parent_frame_id_(parent_frame_id),
113 pending_data_count_(0), 108 pending_data_count_(0),
114 is_download_(is_download), 109 is_download_(is_download),
115 allow_download_(allow_download), 110 allow_download_(allow_download),
116 has_user_gesture_(has_user_gesture), 111 has_user_gesture_(has_user_gesture),
117 pause_count_(0),
118 resource_type_(resource_type), 112 resource_type_(resource_type),
119 transition_type_(transition_type), 113 transition_type_(transition_type),
120 upload_size_(upload_size), 114 upload_size_(upload_size),
121 last_upload_position_(0),
122 waiting_for_upload_progress_ack_(false),
123 memory_cost_(0), 115 memory_cost_(0),
124 referrer_policy_(referrer_policy), 116 referrer_policy_(referrer_policy),
125 context_(context), 117 context_(context) {
126 is_paused_(false),
127 called_on_response_started_(false),
128 has_started_reading_(false),
129 paused_read_bytes_(0) {
130 } 118 }
131 119
132 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { 120 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
133 // Run ResourceHandler destructor before we tear-down the rest of our state
134 // as the ResourceHandler may want to inspect some of our other members.
135 resource_handler_.reset();
136 } 121 }
137 122
138 ResourceContext* ResourceRequestInfoImpl::GetContext() const { 123 ResourceContext* ResourceRequestInfoImpl::GetContext() const {
139 return context_; 124 return context_;
140 } 125 }
141 126
142 int ResourceRequestInfoImpl::GetChildID() const { 127 int ResourceRequestInfoImpl::GetChildID() const {
143 return child_id_; 128 return child_id_;
144 } 129 }
145 130
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 request->SetUserData(NULL, this); 193 request->SetUserData(NULL, this);
209 int render_process_id; 194 int render_process_id;
210 int render_view_id; 195 int render_view_id;
211 if (GetAssociatedRenderView(&render_process_id, &render_view_id)) { 196 if (GetAssociatedRenderView(&render_process_id, &render_view_id)) {
212 request->SetUserData( 197 request->SetUserData(
213 URLRequestUserData::kUserDataKey, 198 URLRequestUserData::kUserDataKey,
214 new URLRequestUserData(render_process_id, render_view_id)); 199 new URLRequestUserData(render_process_id, render_view_id));
215 } 200 }
216 } 201 }
217 202
218 void ResourceRequestInfoImpl::InsertDoomedResourceHandler() { 203 GlobalRequestID ResourceRequestInfoImpl::GetGlobalRequestID() const {
219 resource_handler_.reset( 204 return GlobalRequestID(child_id_, request_id_);
220 new DoomedResourceHandler(resource_handler_.Pass()));
221 }
222
223 void ResourceRequestInfoImpl::set_login_delegate(
224 ResourceDispatcherHostLoginDelegate* ld) {
225 login_delegate_ = ld;
226 }
227
228 void ResourceRequestInfoImpl::set_ssl_client_auth_handler(
229 SSLClientAuthHandler* s) {
230 ssl_client_auth_handler_ = s;
231 } 205 }
232 206
233 void ResourceRequestInfoImpl::set_requested_blob_data( 207 void ResourceRequestInfoImpl::set_requested_blob_data(
234 webkit_blob::BlobData* data) { 208 webkit_blob::BlobData* data) {
235 requested_blob_data_ = data; 209 requested_blob_data_ = data;
236 } 210 }
237 211
238 } // namespace content 212 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698