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

Side by Side Diff: net/url_request/url_request_data_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_data_job.h ('k') | net/url_request/url_request_error_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 // Simple implementation of a data: protocol handler. 5 // Simple implementation of a data: protocol handler.
6 6
7 #include "net/url_request/url_request_data_job.h" 7 #include "net/url_request/url_request_data_job.h"
8 8
9 #include "net/base/data_url.h" 9 #include "net/base/data_url.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 URLRequestDataJob::URLRequestDataJob(URLRequest* request) 14 URLRequestDataJob::URLRequestDataJob(
15 : URLRequestSimpleJob(request) { 15 URLRequest* request, NetworkDelegate* network_delegate)
16 : URLRequestSimpleJob(request, network_delegate) {
16 } 17 }
17 18
18 // static 19 // static
19 URLRequestJob* URLRequestDataJob::Factory(URLRequest* request, 20 URLRequestJob* URLRequestDataJob::Factory(URLRequest* request,
21 NetworkDelegate* network_delegate,
20 const std::string& scheme) { 22 const std::string& scheme) {
21 return new URLRequestDataJob(request); 23 return new URLRequestDataJob(request, network_delegate);
22 } 24 }
23 25
24 int URLRequestDataJob::GetData(std::string* mime_type, 26 int URLRequestDataJob::GetData(std::string* mime_type,
25 std::string* charset, 27 std::string* charset,
26 std::string* data, 28 std::string* data,
27 const CompletionCallback& callback) const { 29 const CompletionCallback& callback) const {
28 // Check if data URL is valid. If not, don't bother to try to extract data. 30 // Check if data URL is valid. If not, don't bother to try to extract data.
29 // Otherwise, parse the data from the data URL. 31 // Otherwise, parse the data from the data URL.
30 const GURL& url = request_->url(); 32 const GURL& url = request_->url();
31 if (!url.is_valid()) 33 if (!url.is_valid())
32 return ERR_INVALID_URL; 34 return ERR_INVALID_URL;
33 return DataURL::Parse(url, mime_type, charset, data)? OK: ERR_INVALID_URL; 35 return DataURL::Parse(url, mime_type, charset, data)? OK: ERR_INVALID_URL;
34 } 36 }
35 37
36 URLRequestDataJob::~URLRequestDataJob() { 38 URLRequestDataJob::~URLRequestDataJob() {
37 } 39 }
38 40
39 } // namespace net 41 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_data_job.h ('k') | net/url_request/url_request_error_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698