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

Side by Side Diff: mojo/package_manager/package_manager_impl.cc

Issue 1356623002: mojo: Add DataURLFetcher for processing data: urls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lolgyp Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/package_manager/package_manager_impl.h" 5 #include "mojo/package_manager/package_manager_impl.h"
6 6
7 #include "mojo/fetcher/about_fetcher.h" 7 #include "mojo/fetcher/about_fetcher.h"
8 #include "mojo/fetcher/data_fetcher.h"
8 #include "mojo/fetcher/local_fetcher.h" 9 #include "mojo/fetcher/local_fetcher.h"
9 #include "mojo/fetcher/network_fetcher.h" 10 #include "mojo/fetcher/network_fetcher.h"
10 #include "mojo/fetcher/switches.h" 11 #include "mojo/fetcher/switches.h"
11 #include "mojo/fetcher/update_fetcher.h" 12 #include "mojo/fetcher/update_fetcher.h"
12 #include "mojo/shell/application_manager.h" 13 #include "mojo/shell/application_manager.h"
13 #include "mojo/shell/query_util.h" 14 #include "mojo/shell/query_util.h"
14 #include "mojo/shell/switches.h" 15 #include "mojo/shell/switches.h"
15 #include "mojo/util/filename_util.h" 16 #include "mojo/util/filename_util.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 void PackageManagerImpl::FetchRequest( 62 void PackageManagerImpl::FetchRequest(
62 URLRequestPtr request, 63 URLRequestPtr request,
63 const shell::Fetcher::FetchCallback& loader_callback) { 64 const shell::Fetcher::FetchCallback& loader_callback) {
64 GURL url(request->url); 65 GURL url(request->url);
65 if (url.SchemeIs(fetcher::AboutFetcher::kAboutScheme)) { 66 if (url.SchemeIs(fetcher::AboutFetcher::kAboutScheme)) {
66 fetcher::AboutFetcher::Start(url, loader_callback); 67 fetcher::AboutFetcher::Start(url, loader_callback);
67 return; 68 return;
68 } 69 }
69 70
71 if (url.SchemeIs(url::kDataScheme)) {
72 fetcher::DataFetcher::Start(url, loader_callback);
73 return;
74 }
75
70 GURL resolved_url = ResolveURL(url); 76 GURL resolved_url = ResolveURL(url);
71 77
72 if (resolved_url.SchemeIsFile()) { 78 if (resolved_url.SchemeIsFile()) {
73 // LocalFetcher uses the network service to infer MIME types from URLs. 79 // LocalFetcher uses the network service to infer MIME types from URLs.
74 // Skip this for mojo URLs to avoid recursively loading the network service. 80 // Skip this for mojo URLs to avoid recursively loading the network service.
75 if (!network_service_ && !url.SchemeIs("mojo")) { 81 if (!network_service_ && !url.SchemeIs("mojo")) {
76 application_manager_->ConnectToService(GURL("mojo:network_service"), 82 application_manager_->ConnectToService(GURL("mojo:network_service"),
77 &network_service_); 83 &network_service_);
78 } 84 }
79 // Ownership of this object is transferred to |loader_callback|. 85 // Ownership of this object is transferred to |loader_callback|.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 : std::string(); 169 : std::string();
164 *content_handler_url = alias_iter->second.first; 170 *content_handler_url = alias_iter->second.first;
165 return true; 171 return true;
166 } 172 }
167 173
168 return false; 174 return false;
169 } 175 }
170 176
171 } // namespace package_manager 177 } // namespace package_manager
172 } // namespace mojo 178 } // namespace mojo
OLDNEW
« mojo/fetcher/data_fetcher.cc ('K') | « mojo/mojo_shell.gyp ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698