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

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

Issue 1354043002: Revert of 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/local_fetcher.h" 8 #include "mojo/fetcher/local_fetcher.h"
9 #include "mojo/fetcher/network_fetcher.h" 9 #include "mojo/fetcher/network_fetcher.h"
10 #include "mojo/fetcher/switches.h" 10 #include "mojo/fetcher/switches.h"
11 #include "mojo/fetcher/update_fetcher.h" 11 #include "mojo/fetcher/update_fetcher.h"
12 #include "mojo/shell/application_manager.h" 12 #include "mojo/shell/application_manager.h"
13 #include "mojo/shell/connect_util.h"
14 #include "mojo/shell/query_util.h" 13 #include "mojo/shell/query_util.h"
15 #include "mojo/shell/switches.h" 14 #include "mojo/shell/switches.h"
16 #include "mojo/util/filename_util.h" 15 #include "mojo/util/filename_util.h"
17 #include "url/gurl.h" 16 #include "url/gurl.h"
18 17
19 namespace mojo { 18 namespace mojo {
20 namespace package_manager { 19 namespace package_manager {
21 20
22 PackageManagerImpl::PackageManagerImpl( 21 PackageManagerImpl::PackageManagerImpl(
23 const base::FilePath& shell_file_root) 22 const base::FilePath& shell_file_root)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 fetcher::AboutFetcher::Start(url, loader_callback); 66 fetcher::AboutFetcher::Start(url, loader_callback);
68 return; 67 return;
69 } 68 }
70 69
71 GURL resolved_url = ResolveURL(url); 70 GURL resolved_url = ResolveURL(url);
72 71
73 if (resolved_url.SchemeIsFile()) { 72 if (resolved_url.SchemeIsFile()) {
74 // LocalFetcher uses the network service to infer MIME types from URLs. 73 // LocalFetcher uses the network service to infer MIME types from URLs.
75 // Skip this for mojo URLs to avoid recursively loading the network service. 74 // Skip this for mojo URLs to avoid recursively loading the network service.
76 if (!network_service_ && !url.SchemeIs("mojo")) { 75 if (!network_service_ && !url.SchemeIs("mojo")) {
77 shell::ConnectToService(application_manager_, 76 application_manager_->ConnectToService(GURL("mojo:network_service"),
78 GURL("mojo:network_service"), &network_service_); 77 &network_service_);
79 } 78 }
80 // Ownership of this object is transferred to |loader_callback|. 79 // Ownership of this object is transferred to |loader_callback|.
81 // TODO(beng): this is eff'n weird. 80 // TODO(beng): this is eff'n weird.
82 new fetcher::LocalFetcher( 81 new fetcher::LocalFetcher(
83 network_service_.get(), resolved_url, 82 network_service_.get(), resolved_url,
84 shell::GetBaseURLAndQuery(resolved_url, nullptr), 83 shell::GetBaseURLAndQuery(resolved_url, nullptr),
85 loader_callback); 84 loader_callback);
86 return; 85 return;
87 } 86 }
88 87
89 #if 0 88 #if 0
90 // TODO(beng): figure out how this should be integrated now that mapped_url 89 // TODO(beng): figure out how this should be integrated now that mapped_url
91 // is toast. 90 // is toast.
92 // TODO(scottmg): to quote someone I know, if you liked this you shouldda put 91 // TODO(scottmg): to quote someone I know, if you liked this you shouldda put
93 // a test on it. 92 // a test on it.
94 if (url.SchemeIs("mojo") && 93 if (url.SchemeIs("mojo") &&
95 base::CommandLine::ForCurrentProcess()->HasSwitch( 94 base::CommandLine::ForCurrentProcess()->HasSwitch(
96 switches::kUseUpdater)) { 95 switches::kUseUpdater)) {
97 shell::ConnectToService(application_manager_, GURL("mojo:updater"), 96 application_manager_->ConnectToService(GURL("mojo:updater"), &updater_);
98 &updater_);
99 // Ownership of this object is transferred to |loader_callback|. 97 // Ownership of this object is transferred to |loader_callback|.
100 // TODO(beng): this is eff'n weird. 98 // TODO(beng): this is eff'n weird.
101 new fetcher::UpdateFetcher(url, updater_.get(), loader_callback); 99 new fetcher::UpdateFetcher(url, updater_.get(), loader_callback);
102 return; 100 return;
103 } 101 }
104 #endif 102 #endif
105 103
106 if (!url_loader_factory_) { 104 if (!url_loader_factory_) {
107 shell::ConnectToService(application_manager_, GURL("mojo:network_service"), 105 application_manager_->ConnectToService(GURL("mojo:network_service"),
108 &url_loader_factory_); 106 &url_loader_factory_);
109 } 107 }
110 108
111 // Ownership of this object is transferred to |loader_callback|. 109 // Ownership of this object is transferred to |loader_callback|.
112 // TODO(beng): this is eff'n weird. 110 // TODO(beng): this is eff'n weird.
113 new fetcher::NetworkFetcher(disable_cache_, request.Pass(), 111 new fetcher::NetworkFetcher(disable_cache_, request.Pass(),
114 url_loader_factory_.get(), loader_callback); 112 url_loader_factory_.get(), loader_callback);
115 } 113 }
116 114
117 bool PackageManagerImpl::HandleWithContentHandler(shell::Fetcher* fetcher, 115 bool PackageManagerImpl::HandleWithContentHandler(shell::Fetcher* fetcher,
118 const GURL& unresolved_url, 116 const GURL& unresolved_url,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 : std::string(); 163 : std::string();
166 *content_handler_url = alias_iter->second.first; 164 *content_handler_url = alias_iter->second.first;
167 return true; 165 return true;
168 } 166 }
169 167
170 return false; 168 return false;
171 } 169 }
172 170
173 } // namespace package_manager 171 } // namespace package_manager
174 } // namespace mojo 172 } // 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