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

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: NetworkDelegate fixed almost everywhere 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
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" 12 #include "net/url_request/url_request.h"
mmenke 2012/08/21 15:28:49 Not needed?
shalev 2012/08/22 20:34:10 Done.
13 #include "net/url_request/url_request_context.h"
14 #include "net/url_request/url_request_status.h" 13 #include "net/url_request/url_request_status.h"
15 14
16 namespace net { 15 namespace net {
17 16
18 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request) 17 URLRequestSimpleJob::URLRequestSimpleJob(
19 : URLRequestJob(request, request->context()->network_delegate()), 18 URLRequest* request, NetworkDelegate* network_delegate)
19 : URLRequestJob(request, network_delegate),
20 data_offset_(0), 20 data_offset_(0),
21 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} 21 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
22 22
23 void URLRequestSimpleJob::Start() { 23 void URLRequestSimpleJob::Start() {
24 // Start reading asynchronously so that all error reporting and data 24 // Start reading asynchronously so that all error reporting and data
25 // callbacks happen as they would for network requests. 25 // callbacks happen as they would for network requests.
26 MessageLoop::current()->PostTask( 26 MessageLoop::current()->PostTask(
27 FROM_HERE, 27 FROM_HERE,
28 base::Bind(&URLRequestSimpleJob::StartAsync, 28 base::Bind(&URLRequestSimpleJob::StartAsync,
29 weak_factory_.GetWeakPtr())); 29 weak_factory_.GetWeakPtr()));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void URLRequestSimpleJob::OnGetDataCompleted(int result) { 67 void URLRequestSimpleJob::OnGetDataCompleted(int result) {
68 if (result == OK) { 68 if (result == OK) {
69 // Notify that the headers are complete 69 // Notify that the headers are complete
70 NotifyHeadersComplete(); 70 NotifyHeadersComplete();
71 } else { 71 } else {
72 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 72 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
73 } 73 }
74 } 74 }
75 75
76 } // namespace net 76 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698