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

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

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
11 11
12 // static 12 // static
13 URLRequestJob* URLRequestDataJob::Factory(URLRequest* request, 13 URLRequestJob* URLRequestDataJob::Factory(net::URLRequest* request,
14 const std::string& scheme) { 14 const std::string& scheme) {
15 return new URLRequestDataJob(request); 15 return new URLRequestDataJob(request);
16 } 16 }
17 17
18 URLRequestDataJob::URLRequestDataJob(URLRequest* request) 18 URLRequestDataJob::URLRequestDataJob(net::URLRequest* request)
19 : URLRequestSimpleJob(request) { 19 : URLRequestSimpleJob(request) {
20 } 20 }
21 21
22 bool URLRequestDataJob::GetData(std::string* mime_type, 22 bool URLRequestDataJob::GetData(std::string* mime_type,
23 std::string* charset, 23 std::string* charset,
24 std::string* data) const { 24 std::string* data) const {
25 // Check if data URL is valid. If not, don't bother to try to extract data. 25 // Check if data URL is valid. If not, don't bother to try to extract data.
26 // Otherwise, parse the data from the data URL. 26 // Otherwise, parse the data from the data URL.
27 const GURL& url = request_->url(); 27 const GURL& url = request_->url();
28 if (!url.is_valid()) 28 if (!url.is_valid())
29 return false; 29 return false;
30 return net::DataURL::Parse(url, mime_type, charset, data); 30 return net::DataURL::Parse(url, mime_type, charset, data);
31 } 31 }
32 32
33 URLRequestDataJob::~URLRequestDataJob() { 33 URLRequestDataJob::~URLRequestDataJob() {
34 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698