| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/url_request/url_request_simple_job.h" | 5 #include "net/url_request/url_request_simple_job.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/url_request/url_request_status.h" | 9 #include "net/url_request/url_request_status.h" |
| 10 | 10 |
| 11 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) | 11 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) |
| 12 : URLRequestJob(request), | 12 : URLRequestJob(request), |
| 13 data_offset_(0) { | 13 data_offset_(0) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 void URLRequestSimpleJob::Start() { | 16 void URLRequestSimpleJob::Start() { |
| 17 // Start reading asynchronously so that all error reporting and data | 17 // Start reading asynchronously so that all error reporting and data |
| 18 // callbacks happen as they would for network requests. | 18 // callbacks happen as they would for network requests. |
| 19 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 19 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 20 this, &URLRequestSimpleJob::StartAsync)); | 20 this, &URLRequestSimpleJob::StartAsync)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) { | 23 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { |
| 24 *mime_type = mime_type_; | 24 *mime_type = mime_type_; |
| 25 return true; | 25 return true; |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool URLRequestSimpleJob::GetCharset(std::string* charset) { | 28 bool URLRequestSimpleJob::GetCharset(std::string* charset) { |
| 29 *charset = charset_; | 29 *charset = charset_; |
| 30 return true; | 30 return true; |
| 31 } | 31 } |
| 32 | 32 |
| 33 bool URLRequestSimpleJob::ReadRawData(net::IOBuffer* buf, int buf_size, | 33 bool URLRequestSimpleJob::ReadRawData(net::IOBuffer* buf, int buf_size, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 if (GetData(&mime_type_, &charset_, &data_)) { | 49 if (GetData(&mime_type_, &charset_, &data_)) { |
| 50 // Notify that the headers are complete | 50 // Notify that the headers are complete |
| 51 NotifyHeadersComplete(); | 51 NotifyHeadersComplete(); |
| 52 } else { | 52 } else { |
| 53 // what should the error code be? | 53 // what should the error code be? |
| 54 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, | 54 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, |
| 55 net::ERR_INVALID_URL)); | 55 net::ERR_INVALID_URL)); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| OLD | NEW |