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 "net/url_request/url_request_simple_job.h" | 5 #include "net/url_request/url_request_simple_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 "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/url_request/url_request.h" |
| 13 #include "net/url_request/url_request_context.h" |
12 #include "net/url_request/url_request_status.h" | 14 #include "net/url_request/url_request_status.h" |
13 | 15 |
14 namespace net { | 16 namespace net { |
15 | 17 |
16 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) | 18 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) |
17 : URLRequestJob(request), | 19 : URLRequestJob(request, request->context()->network_delegate()), |
18 data_offset_(0), | 20 data_offset_(0), |
19 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 21 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} |
20 | 22 |
21 void URLRequestSimpleJob::Start() { | 23 void URLRequestSimpleJob::Start() { |
22 // Start reading asynchronously so that all error reporting and data | 24 // Start reading asynchronously so that all error reporting and data |
23 // callbacks happen as they would for network requests. | 25 // callbacks happen as they would for network requests. |
24 MessageLoop::current()->PostTask( | 26 MessageLoop::current()->PostTask( |
25 FROM_HERE, | 27 FROM_HERE, |
26 base::Bind(&URLRequestSimpleJob::StartAsync, | 28 base::Bind(&URLRequestSimpleJob::StartAsync, |
27 weak_factory_.GetWeakPtr())); | 29 weak_factory_.GetWeakPtr())); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Notify that the headers are complete | 61 // Notify that the headers are complete |
60 NotifyHeadersComplete(); | 62 NotifyHeadersComplete(); |
61 } else { | 63 } else { |
62 // what should the error code be? | 64 // what should the error code be? |
63 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, | 65 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, |
64 ERR_INVALID_URL)); | 66 ERR_INVALID_URL)); |
65 } | 67 } |
66 } | 68 } |
67 | 69 |
68 } // namespace net | 70 } // namespace net |
OLD | NEW |