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 "chrome/browser/automation/url_request_automation_job.h" | 5 #include "chrome/browser/automation/url_request_automation_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/browser/automation/automation_resource_message_filter.h" | 11 #include "chrome/browser/automation/automation_resource_message_filter.h" |
12 #include "chrome/common/automation_messages.h" | 12 #include "chrome/common/automation_messages.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/resource_request_info.h" | 15 #include "content/public/browser/resource_request_info.h" |
16 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 #include "net/cookies/cookie_monster.h" | 19 #include "net/cookies/cookie_monster.h" |
20 #include "net/http/http_request_headers.h" | 20 #include "net/http/http_request_headers.h" |
21 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
22 #include "net/http/http_util.h" | 22 #include "net/http/http_util.h" |
| 23 #include "net/url_request/url_request.h" |
23 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
24 | 25 |
25 using base::Time; | 26 using base::Time; |
26 using base::TimeDelta; | 27 using base::TimeDelta; |
27 using content::BrowserThread; | 28 using content::BrowserThread; |
28 using content::ResourceRequestInfo; | 29 using content::ResourceRequestInfo; |
29 | 30 |
30 // The list of filtered headers that are removed from requests sent via | 31 // The list of filtered headers that are removed from requests sent via |
31 // StartAsync(). These must be lower case. | 32 // StartAsync(). These must be lower case. |
32 static const char* const kFilteredHeaderStrings[] = { | 33 static const char* const kFilteredHeaderStrings[] = { |
(...skipping 15 matching lines...) Expand all Loading... |
48 = NULL; | 49 = NULL; |
49 net::URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_ | 50 net::URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_ |
50 = NULL; | 51 = NULL; |
51 | 52 |
52 URLRequestAutomationJob::URLRequestAutomationJob( | 53 URLRequestAutomationJob::URLRequestAutomationJob( |
53 net::URLRequest* request, | 54 net::URLRequest* request, |
54 int tab, | 55 int tab, |
55 int request_id, | 56 int request_id, |
56 AutomationResourceMessageFilter* filter, | 57 AutomationResourceMessageFilter* filter, |
57 bool is_pending) | 58 bool is_pending) |
58 : net::URLRequestJob(request), | 59 : net::URLRequestJob(request, request->context()->network_delegate()), |
59 id_(0), | 60 id_(0), |
60 tab_(tab), | 61 tab_(tab), |
61 message_filter_(filter), | 62 message_filter_(filter), |
62 pending_buf_size_(0), | 63 pending_buf_size_(0), |
63 redirect_status_(0), | 64 redirect_status_(0), |
64 request_id_(request_id), | 65 request_id_(request_id), |
65 is_pending_(is_pending), | 66 is_pending_(is_pending), |
66 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 67 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
67 DVLOG(1) << "URLRequestAutomationJob create. Count: " << ++instance_count_; | 68 DVLOG(1) << "URLRequestAutomationJob create. Count: " << ++instance_count_; |
68 DCHECK(message_filter_ != NULL); | 69 DCHECK(message_filter_ != NULL); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 if (!is_done()) { | 487 if (!is_done()) { |
487 NotifyDone(request_status_); | 488 NotifyDone(request_status_); |
488 } | 489 } |
489 // Reset any pending reads. | 490 // Reset any pending reads. |
490 if (pending_buf_) { | 491 if (pending_buf_) { |
491 pending_buf_ = NULL; | 492 pending_buf_ = NULL; |
492 pending_buf_size_ = 0; | 493 pending_buf_size_ = 0; |
493 NotifyReadComplete(0); | 494 NotifyReadComplete(0); |
494 } | 495 } |
495 } | 496 } |
OLD | NEW |