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/fetcher/base_application_fetcher.h" | 5 #include "mojo/fetcher/base_application_fetcher.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/util/filename_util.h" | 15 #include "mojo/util/filename_util.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace mojo { | 18 namespace mojo { |
(...skipping 25 matching lines...) Expand all Loading... |
43 | 44 |
44 void BaseApplicationFetcher::FetchRequest( | 45 void BaseApplicationFetcher::FetchRequest( |
45 URLRequestPtr request, | 46 URLRequestPtr request, |
46 const shell::Fetcher::FetchCallback& loader_callback) { | 47 const shell::Fetcher::FetchCallback& loader_callback) { |
47 GURL url(request->url); | 48 GURL url(request->url); |
48 if (url.SchemeIs(AboutFetcher::kAboutScheme)) { | 49 if (url.SchemeIs(AboutFetcher::kAboutScheme)) { |
49 AboutFetcher::Start(url, loader_callback); | 50 AboutFetcher::Start(url, loader_callback); |
50 return; | 51 return; |
51 } | 52 } |
52 | 53 |
| 54 if (url.SchemeIs(url::kDataScheme)) { |
| 55 DataFetcher::Start(url, loader_callback); |
| 56 return; |
| 57 } |
| 58 |
53 GURL resolved_url = ResolveURL(url); | 59 GURL resolved_url = ResolveURL(url); |
54 | 60 |
55 if (resolved_url.SchemeIsFile()) { | 61 if (resolved_url.SchemeIsFile()) { |
56 // LocalFetcher uses the network service to infer MIME types from URLs. | 62 // LocalFetcher uses the network service to infer MIME types from URLs. |
57 // Skip this for mojo URLs to avoid recursively loading the network service. | 63 // Skip this for mojo URLs to avoid recursively loading the network service. |
58 if (!network_service_ && !url.SchemeIs("mojo")) { | 64 if (!network_service_ && !url.SchemeIs("mojo")) { |
59 application_manager_->ConnectToService(GURL("mojo:network_service"), | 65 application_manager_->ConnectToService(GURL("mojo:network_service"), |
60 &network_service_); | 66 &network_service_); |
61 } | 67 } |
62 // Ownership of this object is transferred to |loader_callback|. | 68 // Ownership of this object is transferred to |loader_callback|. |
(...skipping 27 matching lines...) Expand all Loading... |
90 } | 96 } |
91 | 97 |
92 // Ownership of this object is transferred to |loader_callback|. | 98 // Ownership of this object is transferred to |loader_callback|. |
93 // TODO(beng): this is eff'n weird. | 99 // TODO(beng): this is eff'n weird. |
94 new NetworkFetcher(disable_cache_, request.Pass(), url_loader_factory_.get(), | 100 new NetworkFetcher(disable_cache_, request.Pass(), url_loader_factory_.get(), |
95 loader_callback); | 101 loader_callback); |
96 } | 102 } |
97 | 103 |
98 } // namespace fetcher | 104 } // namespace fetcher |
99 } // namespace mojo | 105 } // namespace mojo |
OLD | NEW |