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

Side by Side Diff: content/browser/mojo/mojo_shell_context.cc

Issue 1343823002: Revert of Move fetching logic out of ApplicationManager, eliminate url mappings. (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 | « content/browser/mojo/mojo_shell_context.h ('k') | content/content_browser.gypi » ('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 "content/browser/mojo/mojo_shell_context.h" 5 #include "content/browser/mojo/mojo_shell_context.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/path_service.h"
10 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
12 #include "content/common/process_control.mojom.h" 11 #include "content/common/process_control.mojom.h"
13 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/content_browser_client.h" 13 #include "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/utility_process_host.h" 14 #include "content/public/browser/utility_process_host.h"
16 #include "content/public/browser/utility_process_host_client.h" 15 #include "content/public/browser/utility_process_host_client.h"
17 #include "content/public/common/content_client.h" 16 #include "content/public/common/content_client.h"
18 #include "content/public/common/service_registry.h" 17 #include "content/public/common/service_registry.h"
19 #include "mojo/application/public/cpp/application_delegate.h" 18 #include "mojo/application/public/cpp/application_delegate.h"
20 #include "mojo/common/url_type_converters.h" 19 #include "mojo/common/url_type_converters.h"
21 #include "mojo/fetcher/base_application_fetcher.h"
22 #include "mojo/shell/application_loader.h" 20 #include "mojo/shell/application_loader.h"
23 #include "mojo/shell/connect_to_application_params.h" 21 #include "mojo/shell/connect_to_application_params.h"
24 #include "mojo/shell/identity.h" 22 #include "mojo/shell/identity.h"
25 #include "mojo/shell/static_application_loader.h" 23 #include "mojo/shell/static_application_loader.h"
26 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
27 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" 25 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
28 26
29 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 27 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
30 #include "media/mojo/services/mojo_media_application.h" 28 #include "media/mojo/services/mojo_media_application.h"
31 #endif 29 #endif
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 145
148 // static 146 // static
149 base::LazyInstance<scoped_ptr<MojoShellContext::Proxy>> 147 base::LazyInstance<scoped_ptr<MojoShellContext::Proxy>>
150 MojoShellContext::proxy_ = LAZY_INSTANCE_INITIALIZER; 148 MojoShellContext::proxy_ = LAZY_INSTANCE_INITIALIZER;
151 149
152 void MojoShellContext::SetApplicationsForTest( 150 void MojoShellContext::SetApplicationsForTest(
153 const StaticApplicationMap* apps) { 151 const StaticApplicationMap* apps) {
154 g_applications_for_test = apps; 152 g_applications_for_test = apps;
155 } 153 }
156 154
157 MojoShellContext::MojoShellContext() { 155 MojoShellContext::MojoShellContext()
156 : application_manager_(new mojo::shell::ApplicationManager(this)) {
158 proxy_.Get().reset(new Proxy(this)); 157 proxy_.Get().reset(new Proxy(this));
159 158
160 // Construct with an empty filepath since mojo: urls can't be registered now
161 // the url scheme registry is locked.
162 scoped_ptr<mojo::fetcher::BaseApplicationFetcher> fetcher(
163 new mojo::fetcher::BaseApplicationFetcher(base::FilePath()));
164 application_manager_.reset(
165 new mojo::shell::ApplicationManager(fetcher.Pass()));
166
167 application_manager_->set_default_loader( 159 application_manager_->set_default_loader(
168 scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader)); 160 scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader));
169 161
170 StaticApplicationMap apps; 162 StaticApplicationMap apps;
171 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); 163 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps);
172 if (g_applications_for_test) { 164 if (g_applications_for_test) {
173 // Add testing apps to the map, potentially overwriting whatever the 165 // Add testing apps to the map, potentially overwriting whatever the
174 // browser client registered. 166 // browser client registered.
175 for (const auto& entry : *g_applications_for_test) 167 for (const auto& entry : *g_applications_for_test)
176 apps[entry.first] = entry.second; 168 apps[entry.first] = entry.second;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 params->set_originator_filter(mojo::shell::GetPermissiveCapabilityFilter()); 233 params->set_originator_filter(mojo::shell::GetPermissiveCapabilityFilter());
242 params->SetURLInfo(url); 234 params->SetURLInfo(url);
243 params->set_services(request.Pass()); 235 params->set_services(request.Pass());
244 params->set_exposed_services(exposed_services.Pass()); 236 params->set_exposed_services(exposed_services.Pass());
245 params->set_filter(filter); 237 params->set_filter(filter);
246 params->set_on_application_end(base::Bind(&base::DoNothing)); 238 params->set_on_application_end(base::Bind(&base::DoNothing));
247 params->set_connect_callback(callback); 239 params->set_connect_callback(callback);
248 application_manager_->ConnectToApplication(params.Pass()); 240 application_manager_->ConnectToApplication(params.Pass());
249 } 241 }
250 242
243 GURL MojoShellContext::ResolveMappings(const GURL& url) {
244 return url;
245 }
246
247 GURL MojoShellContext::ResolveMojoURL(const GURL& url) {
248 return url;
249 }
250
251 bool MojoShellContext::CreateFetcher(
252 const GURL& url,
253 const mojo::shell::Fetcher::FetchCallback& loader_callback) {
254 return false;
255 }
256
251 } // namespace content 257 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_shell_context.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698