| OLD | NEW |
| 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/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void URLRequestAutomationJob::Start() { | 116 void URLRequestAutomationJob::Start() { |
| 117 // Start reading asynchronously so that all error reporting and data | 117 // Start reading asynchronously so that all error reporting and data |
| 118 // callbacks happen as they would for network requests. | 118 // callbacks happen as they would for network requests. |
| 119 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 119 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 120 this, &URLRequestAutomationJob::StartAsync)); | 120 this, &URLRequestAutomationJob::StartAsync)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void URLRequestAutomationJob::Kill() { | 123 void URLRequestAutomationJob::Kill() { |
| 124 if (message_filter_.get()) { | 124 if (message_filter_.get()) { |
| 125 message_filter_->Send(new AutomationMsg_RequestEnd(0, tab_, id_, | 125 message_filter_->Send(new AutomationMsg_RequestEnd(0, tab_, id_, |
| 126 URLRequestStatus(URLRequestStatus::CANCELED, 0))); | 126 URLRequestStatus(URLRequestStatus::CANCELED, net::ERR_ABORTED))); |
| 127 } | 127 } |
| 128 DisconnectFromMessageFilter(); | 128 DisconnectFromMessageFilter(); |
| 129 URLRequestJob::Kill(); | 129 URLRequestJob::Kill(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool URLRequestAutomationJob::ReadRawData( | 132 bool URLRequestAutomationJob::ReadRawData( |
| 133 net::IOBuffer* buf, int buf_size, int* bytes_read) { | 133 net::IOBuffer* buf, int buf_size, int* bytes_read) { |
| 134 DLOG(INFO) << "URLRequestAutomationJob: " << | 134 DLOG(INFO) << "URLRequestAutomationJob: " << |
| 135 request_->url().spec() << " - read pending: " << buf_size; | 135 request_->url().spec() << " - read pending: " << buf_size; |
| 136 pending_buf_ = buf; | 136 pending_buf_ = buf; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, | 408 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, |
| 409 automation_request)); | 409 automation_request)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void URLRequestAutomationJob::DisconnectFromMessageFilter() { | 412 void URLRequestAutomationJob::DisconnectFromMessageFilter() { |
| 413 if (message_filter_) { | 413 if (message_filter_) { |
| 414 message_filter_->UnRegisterRequest(this); | 414 message_filter_->UnRegisterRequest(this); |
| 415 message_filter_ = NULL; | 415 message_filter_ = NULL; |
| 416 } | 416 } |
| 417 } | 417 } |
| OLD | NEW |