| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/automation/automation_resource_message_filter.h" | 10 #include "chrome/browser/automation/automation_resource_message_filter.h" |
| 11 #include "chrome/common/automation_messages.h" | 11 #include "chrome/common/automation_messages.h" |
| 12 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
| 13 #include "content/browser/renderer_host/render_view_host.h" | 13 #include "content/browser/renderer_host/render_view_host.h" |
| 14 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 14 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 15 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 15 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 16 #include "net/base/cookie_monster.h" | 16 #include "net/base/cookie_monster.h" |
| 17 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/http/http_request_headers.h" |
| 20 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
| 21 #include "net/http/http_request_headers.h" | |
| 22 #include "net/http/http_util.h" | 22 #include "net/http/http_util.h" |
| 23 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
| 24 | 24 |
| 25 using base::Time; | 25 using base::Time; |
| 26 using base::TimeDelta; | 26 using base::TimeDelta; |
| 27 | 27 |
| 28 // The list of filtered headers that are removed from requests sent via | 28 // The list of filtered headers that are removed from requests sent via |
| 29 // StartAsync(). These must be lower case. | 29 // StartAsync(). These must be lower case. |
| 30 static const char* const kFilteredHeaderStrings[] = { | 30 static const char* const kFilteredHeaderStrings[] = { |
| 31 "connection", | 31 "connection", |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 url = request_->url().spec(); | 338 url = request_->url().spec(); |
| 339 DVLOG(1) << "URLRequestAutomationJob: " << url << " - request end. Status: " | 339 DVLOG(1) << "URLRequestAutomationJob: " << url << " - request end. Status: " |
| 340 << status.status(); | 340 << status.status(); |
| 341 #endif | 341 #endif |
| 342 | 342 |
| 343 // TODO(tommi): When we hit certificate errors, notify the delegate via | 343 // TODO(tommi): When we hit certificate errors, notify the delegate via |
| 344 // OnSSLCertificateError(). Right now we don't have the certificate | 344 // OnSSLCertificateError(). Right now we don't have the certificate |
| 345 // so we don't. We could possibly call OnSSLCertificateError with a NULL | 345 // so we don't. We could possibly call OnSSLCertificateError with a NULL |
| 346 // certificate, but I'm not sure if all implementations expect it. | 346 // certificate, but I'm not sure if all implementations expect it. |
| 347 // if (status.status() == net::URLRequestStatus::FAILED && | 347 // if (status.status() == net::URLRequestStatus::FAILED && |
| 348 // net::IsCertificateError(status.os_error()) && request_->delegate()) { | 348 // net::IsCertificateError(status.error()) && request_->delegate()) { |
| 349 // request_->delegate()->OnSSLCertificateError(request_, status.os_error()); | 349 // request_->delegate()->OnSSLCertificateError(request_, status.error()); |
| 350 // } | 350 // } |
| 351 | 351 |
| 352 DisconnectFromMessageFilter(); | 352 DisconnectFromMessageFilter(); |
| 353 // NotifyDone may have been called on the job if the original request was | 353 // NotifyDone may have been called on the job if the original request was |
| 354 // redirected. | 354 // redirected. |
| 355 if (!is_done()) { | 355 if (!is_done()) { |
| 356 // We can complete the job if we have a valid response or a pending read. | 356 // We can complete the job if we have a valid response or a pending read. |
| 357 // An end request can be received in the following cases | 357 // An end request can be received in the following cases |
| 358 // 1. We failed to connect to the server, in which case we did not receive | 358 // 1. We failed to connect to the server, in which case we did not receive |
| 359 // a valid response. | 359 // a valid response. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (!is_done()) { | 489 if (!is_done()) { |
| 490 NotifyDone(request_status_); | 490 NotifyDone(request_status_); |
| 491 } | 491 } |
| 492 // Reset any pending reads. | 492 // Reset any pending reads. |
| 493 if (pending_buf_) { | 493 if (pending_buf_) { |
| 494 pending_buf_ = NULL; | 494 pending_buf_ = NULL; |
| 495 pending_buf_size_ = 0; | 495 pending_buf_size_ = 0; |
| 496 NotifyReadComplete(0); | 496 NotifyReadComplete(0); |
| 497 } | 497 } |
| 498 } | 498 } |
| OLD | NEW |