| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |