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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_http_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 "base/profiler/scoped_tracker.h"
10 #include "net/base/data_url.h" 9 #include "net/base/data_url.h"
11 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
12 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
13 #include "url/gurl.h" 12 #include "url/gurl.h"
14 13
15 namespace net { 14 namespace net {
16 15
17 int URLRequestDataJob::BuildResponse(const GURL& url, 16 int URLRequestDataJob::BuildResponse(const GURL& url,
18 std::string* mime_type, 17 std::string* mime_type,
19 std::string* charset, 18 std::string* charset,
(...skipping 26 matching lines...) Expand all
46 45
47 URLRequestDataJob::URLRequestDataJob( 46 URLRequestDataJob::URLRequestDataJob(
48 URLRequest* request, NetworkDelegate* network_delegate) 47 URLRequest* request, NetworkDelegate* network_delegate)
49 : URLRequestSimpleJob(request, network_delegate) { 48 : URLRequestSimpleJob(request, network_delegate) {
50 } 49 }
51 50
52 int URLRequestDataJob::GetData(std::string* mime_type, 51 int URLRequestDataJob::GetData(std::string* mime_type,
53 std::string* charset, 52 std::string* charset,
54 std::string* data, 53 std::string* data,
55 const CompletionCallback& callback) const { 54 const CompletionCallback& callback) const {
56 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422489 is fixed.
57 tracked_objects::ScopedTracker tracking_profile(
58 FROM_HERE_WITH_EXPLICIT_FUNCTION("422489 URLRequestDataJob::GetData"));
59
60 // Check if data URL is valid. If not, don't bother to try to extract data. 55 // Check if data URL is valid. If not, don't bother to try to extract data.
61 // Otherwise, parse the data from the data URL. 56 // Otherwise, parse the data from the data URL.
62 const GURL& url = request_->url(); 57 const GURL& url = request_->url();
63 if (!url.is_valid()) 58 if (!url.is_valid())
64 return ERR_INVALID_URL; 59 return ERR_INVALID_URL;
65 60
66 // TODO(tyoshino): Get the headers and export via 61 // TODO(tyoshino): Get the headers and export via
67 // URLRequestJob::GetResponseInfo(). 62 // URLRequestJob::GetResponseInfo().
68 return BuildResponse(url, mime_type, charset, data, NULL); 63 return BuildResponse(url, mime_type, charset, data, NULL);
69 } 64 }
70 65
71 URLRequestDataJob::~URLRequestDataJob() { 66 URLRequestDataJob::~URLRequestDataJob() {
72 } 67 }
73 68
74 } // namespace net 69 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698