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

Unified Diff: net/url_request/url_request_data_job.cc

Issue 297003: Implement URLRequestDataJob (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_data_job.h ('k') | net/url_request/url_request_job_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_data_job.cc
===================================================================
--- net/url_request/url_request_data_job.cc (revision 0)
+++ net/url_request/url_request_data_job.cc (revision 0)
@@ -0,0 +1,33 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Simple implementation of a data: protocol handler.
+
+#include "net/url_request/url_request_data_job.h"
+
+#include "net/base/data_url.h"
+#include "net/url_request/url_request.h"
+
+// static
+URLRequestJob* URLRequestDataJob::Factory(URLRequest* request,
+ const std::string& scheme) {
+ return new URLRequestDataJob(request);
+}
+
+URLRequestDataJob::URLRequestDataJob(URLRequest* request)
+ : URLRequestSimpleJob(request) {
+}
+
+
+bool URLRequestDataJob::GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data) const {
+ // Check if data URL is valid. If not, don't bother to try to extract data.
+ // Otherwise, parse the data from the data URL.
+ const GURL& url = request_->url();
+ if (!url.is_valid())
+ return false;
+ return net::DataURL::Parse(url, mime_type, charset, data);
+}
+
Property changes on: net\url_request\url_request_data_job.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/url_request/url_request_data_job.h ('k') | net/url_request/url_request_job_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698