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

Side by Side Diff: chrome/browser/automation/url_request_automation_job.cc

Issue 402107: ChromeFrame's host network stack implementation for IE full tab mode implicit... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « no previous file | chrome_frame/urlmon_url_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/automation/url_request_automation_job.h" 5 #include "chrome/browser/automation/url_request_automation_job.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "chrome/browser/automation/automation_resource_message_filter.h" 9 #include "chrome/browser/automation/automation_resource_message_filter.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 int URLRequestAutomationJob::GetResponseCode() const { 191 int URLRequestAutomationJob::GetResponseCode() const {
192 if (headers_) 192 if (headers_)
193 return headers_->response_code(); 193 return headers_->response_code();
194 194
195 static const int kDefaultResponseCode = 200; 195 static const int kDefaultResponseCode = 200;
196 return kDefaultResponseCode; 196 return kDefaultResponseCode;
197 } 197 }
198 198
199 bool URLRequestAutomationJob::IsRedirectResponse( 199 bool URLRequestAutomationJob::IsRedirectResponse(
200 GURL* location, int* http_status_code) { 200 GURL* location, int* http_status_code) {
201 static const int kDefaultHttpRedirectResponseCode = 301; 201 if (!net::HttpResponseHeaders::IsRedirectResponseCode(redirect_status_))
202 return false;
202 203
203 if (!redirect_url_.empty()) { 204 *http_status_code = redirect_status_;
204 DLOG_IF(ERROR, redirect_status_ == 0) << "Missing redirect status?"; 205 *location = GURL(redirect_url_);
205 *http_status_code = redirect_status_ ? redirect_status_ : 206 return true;
206 kDefaultHttpRedirectResponseCode;
207 *location = GURL(redirect_url_);
208 return true;
209 } else {
210 DCHECK(redirect_status_ == 0)
211 << "Unexpectedly have redirect status but no URL";
212 }
213
214 return false;
215 } 207 }
216 208
217 bool URLRequestAutomationJob::MayFilterMessage(const IPC::Message& message, 209 bool URLRequestAutomationJob::MayFilterMessage(const IPC::Message& message,
218 int* request_id) { 210 int* request_id) {
219 switch (message.type()) { 211 switch (message.type()) {
220 case AutomationMsg_RequestStarted::ID: 212 case AutomationMsg_RequestStarted::ID:
221 case AutomationMsg_RequestData::ID: 213 case AutomationMsg_RequestData::ID:
222 case AutomationMsg_RequestEnd::ID: { 214 case AutomationMsg_RequestEnd::ID: {
223 void* iter = NULL; 215 void* iter = NULL;
224 int tab = 0; 216 int tab = 0;
(...skipping 23 matching lines...) Expand all
248 set_expected_content_size(response.content_length); 240 set_expected_content_size(response.content_length);
249 mime_type_ = response.mime_type; 241 mime_type_ = response.mime_type;
250 242
251 redirect_url_ = response.redirect_url; 243 redirect_url_ = response.redirect_url;
252 redirect_status_ = response.redirect_status; 244 redirect_status_ = response.redirect_status;
253 DCHECK(redirect_status_ == 0 || redirect_status_ == 200 || 245 DCHECK(redirect_status_ == 0 || redirect_status_ == 200 ||
254 (redirect_status_ >= 300 && redirect_status_ < 400)); 246 (redirect_status_ >= 300 && redirect_status_ < 400));
255 247
256 GURL url_for_cookies = 248 GURL url_for_cookies =
257 GURL(redirect_url_.empty() ? request_->url().spec().c_str() : 249 GURL(redirect_url_.empty() ? request_->url().spec().c_str() :
258 redirect_url_.c_str()); 250 redirect_url_.c_str());
259 251
260 URLRequestContext* ctx = request_->context(); 252 URLRequestContext* ctx = request_->context();
261 253
262 if (!response.headers.empty()) { 254 if (!response.headers.empty()) {
263 headers_ = new net::HttpResponseHeaders( 255 headers_ = new net::HttpResponseHeaders(
264 net::HttpUtil::AssembleRawHeaders(response.headers.data(), 256 net::HttpUtil::AssembleRawHeaders(response.headers.data(),
265 response.headers.size())); 257 response.headers.size()));
266 // Parse and set HTTP cookies. 258 // Parse and set HTTP cookies.
267 const std::string name = "Set-Cookie"; 259 const std::string name = "Set-Cookie";
268 std::string value; 260 std::string value;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, 423 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_,
432 automation_request)); 424 automation_request));
433 } 425 }
434 426
435 void URLRequestAutomationJob::DisconnectFromMessageFilter() { 427 void URLRequestAutomationJob::DisconnectFromMessageFilter() {
436 if (message_filter_) { 428 if (message_filter_) {
437 message_filter_->UnRegisterRequest(this); 429 message_filter_->UnRegisterRequest(this);
438 message_filter_ = NULL; 430 message_filter_ = NULL;
439 } 431 }
440 } 432 }
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/urlmon_url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698