Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: net/url_request/url_request_simple_job.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_simple_job.h ('k') | net/url_request/url_request_test_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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"
14 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
15 13
16 namespace net { 14 namespace net {
17 15
18 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) 16 URLRequestSimpleJob::URLRequestSimpleJob(
19 : URLRequestJob(request, request->context()->network_delegate()), 17 URLRequest* request, NetworkDelegate* network_delegate)
18 : URLRequestJob(request, network_delegate),
20 data_offset_(0), 19 data_offset_(0),
21 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} 20 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
22 21
23 void URLRequestSimpleJob::Start() { 22 void URLRequestSimpleJob::Start() {
24 // Start reading asynchronously so that all error reporting and data 23 // Start reading asynchronously so that all error reporting and data
25 // callbacks happen as they would for network requests. 24 // callbacks happen as they would for network requests.
26 MessageLoop::current()->PostTask( 25 MessageLoop::current()->PostTask(
27 FROM_HERE, 26 FROM_HERE,
28 base::Bind(&URLRequestSimpleJob::StartAsync, 27 base::Bind(&URLRequestSimpleJob::StartAsync,
29 weak_factory_.GetWeakPtr())); 28 weak_factory_.GetWeakPtr()));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void URLRequestSimpleJob::OnGetDataCompleted(int result) { 66 void URLRequestSimpleJob::OnGetDataCompleted(int result) {
68 if (result == OK) { 67 if (result == OK) {
69 // Notify that the headers are complete 68 // Notify that the headers are complete
70 NotifyHeadersComplete(); 69 NotifyHeadersComplete();
71 } else { 70 } else {
72 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 71 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
73 } 72 }
74 } 73 }
75 74
76 } // namespace net 75 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_simple_job.h ('k') | net/url_request/url_request_test_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698