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

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

Issue 1351963002: Some more minor cleanup to ApplicationManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
« no previous file with comments | « mojo/mojo_shell.gyp ('k') | mojo/runner/context.cc » ('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 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/data_fetcher.h"
9 #include "mojo/fetcher/local_fetcher.h" 9 #include "mojo/fetcher/local_fetcher.h"
10 #include "mojo/fetcher/network_fetcher.h" 10 #include "mojo/fetcher/network_fetcher.h"
11 #include "mojo/fetcher/switches.h" 11 #include "mojo/fetcher/switches.h"
12 #include "mojo/fetcher/update_fetcher.h" 12 #include "mojo/fetcher/update_fetcher.h"
13 #include "mojo/shell/application_manager.h" 13 #include "mojo/shell/application_manager.h"
14 #include "mojo/shell/connect_util.h"
14 #include "mojo/shell/query_util.h" 15 #include "mojo/shell/query_util.h"
15 #include "mojo/shell/switches.h" 16 #include "mojo/shell/switches.h"
16 #include "mojo/util/filename_util.h" 17 #include "mojo/util/filename_util.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace mojo { 20 namespace mojo {
20 namespace package_manager { 21 namespace package_manager {
21 22
22 PackageManagerImpl::PackageManagerImpl( 23 PackageManagerImpl::PackageManagerImpl(
23 const base::FilePath& shell_file_root) 24 const base::FilePath& shell_file_root)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 fetcher::DataFetcher::Start(url, loader_callback); 73 fetcher::DataFetcher::Start(url, loader_callback);
73 return; 74 return;
74 } 75 }
75 76
76 GURL resolved_url = ResolveURL(url); 77 GURL resolved_url = ResolveURL(url);
77 78
78 if (resolved_url.SchemeIsFile()) { 79 if (resolved_url.SchemeIsFile()) {
79 // LocalFetcher uses the network service to infer MIME types from URLs. 80 // LocalFetcher uses the network service to infer MIME types from URLs.
80 // Skip this for mojo URLs to avoid recursively loading the network service. 81 // Skip this for mojo URLs to avoid recursively loading the network service.
81 if (!network_service_ && !url.SchemeIs("mojo")) { 82 if (!network_service_ && !url.SchemeIs("mojo")) {
82 application_manager_->ConnectToService(GURL("mojo:network_service"), 83 shell::ConnectToService(application_manager_,
83 &network_service_); 84 GURL("mojo:network_service"), &network_service_);
84 } 85 }
85 // Ownership of this object is transferred to |loader_callback|. 86 // Ownership of this object is transferred to |loader_callback|.
86 // TODO(beng): this is eff'n weird. 87 // TODO(beng): this is eff'n weird.
87 new fetcher::LocalFetcher( 88 new fetcher::LocalFetcher(
88 network_service_.get(), resolved_url, 89 network_service_.get(), resolved_url,
89 shell::GetBaseURLAndQuery(resolved_url, nullptr), 90 shell::GetBaseURLAndQuery(resolved_url, nullptr),
90 loader_callback); 91 loader_callback);
91 return; 92 return;
92 } 93 }
93 94
94 #if 0 95 #if 0
95 // TODO(beng): figure out how this should be integrated now that mapped_url 96 // TODO(beng): figure out how this should be integrated now that mapped_url
96 // is toast. 97 // is toast.
97 // TODO(scottmg): to quote someone I know, if you liked this you shouldda put 98 // TODO(scottmg): to quote someone I know, if you liked this you shouldda put
98 // a test on it. 99 // a test on it.
99 if (url.SchemeIs("mojo") && 100 if (url.SchemeIs("mojo") &&
100 base::CommandLine::ForCurrentProcess()->HasSwitch( 101 base::CommandLine::ForCurrentProcess()->HasSwitch(
101 switches::kUseUpdater)) { 102 switches::kUseUpdater)) {
102 application_manager_->ConnectToService(GURL("mojo:updater"), &updater_); 103 shell::ConnectToService(application_manager_, GURL("mojo:updater"),
104 &updater_);
103 // Ownership of this object is transferred to |loader_callback|. 105 // Ownership of this object is transferred to |loader_callback|.
104 // TODO(beng): this is eff'n weird. 106 // TODO(beng): this is eff'n weird.
105 new fetcher::UpdateFetcher(url, updater_.get(), loader_callback); 107 new fetcher::UpdateFetcher(url, updater_.get(), loader_callback);
106 return; 108 return;
107 } 109 }
108 #endif 110 #endif
109 111
110 if (!url_loader_factory_) { 112 if (!url_loader_factory_) {
111 application_manager_->ConnectToService(GURL("mojo:network_service"), 113 shell::ConnectToService(application_manager_, GURL("mojo:network_service"),
112 &url_loader_factory_); 114 &url_loader_factory_);
113 } 115 }
114 116
115 // Ownership of this object is transferred to |loader_callback|. 117 // Ownership of this object is transferred to |loader_callback|.
116 // TODO(beng): this is eff'n weird. 118 // TODO(beng): this is eff'n weird.
117 new fetcher::NetworkFetcher(disable_cache_, request.Pass(), 119 new fetcher::NetworkFetcher(disable_cache_, request.Pass(),
118 url_loader_factory_.get(), loader_callback); 120 url_loader_factory_.get(), loader_callback);
119 } 121 }
120 122
121 bool PackageManagerImpl::HandleWithContentHandler(shell::Fetcher* fetcher, 123 bool PackageManagerImpl::HandleWithContentHandler(shell::Fetcher* fetcher,
122 const GURL& unresolved_url, 124 const GURL& unresolved_url,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 : std::string(); 171 : std::string();
170 *content_handler_url = alias_iter->second.first; 172 *content_handler_url = alias_iter->second.first;
171 return true; 173 return true;
172 } 174 }
173 175
174 return false; 176 return false;
175 } 177 }
176 178
177 } // namespace package_manager 179 } // namespace package_manager
178 } // namespace mojo 180 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo_shell.gyp ('k') | mojo/runner/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698