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

Side by Side Diff: mojo/runner/context.cc

Issue 1566253002: Move package_manager into mojo/shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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/runner/context.h ('k') | mojo/runner/register_local_aliases.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/runner/context.h" 5 #include "mojo/runner/context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 13 matching lines...) Expand all
24 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
26 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "components/devtools_service/public/cpp/switches.h" 28 #include "components/devtools_service/public/cpp/switches.h"
29 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h " 29 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h "
30 #include "components/tracing/tracing_switches.h" 30 #include "components/tracing/tracing_switches.h"
31 #include "mojo/application/public/cpp/application_connection.h" 31 #include "mojo/application/public/cpp/application_connection.h"
32 #include "mojo/application/public/cpp/application_delegate.h" 32 #include "mojo/application/public/cpp/application_delegate.h"
33 #include "mojo/application/public/cpp/application_impl.h" 33 #include "mojo/application/public/cpp/application_impl.h"
34 #include "mojo/package_manager/package_manager_impl.h"
35 #include "mojo/public/cpp/bindings/strong_binding.h" 34 #include "mojo/public/cpp/bindings/strong_binding.h"
36 #include "mojo/runner/host/in_process_native_runner.h" 35 #include "mojo/runner/host/in_process_native_runner.h"
37 #include "mojo/runner/host/out_of_process_native_runner.h" 36 #include "mojo/runner/host/out_of_process_native_runner.h"
38 #include "mojo/runner/register_local_aliases.h" 37 #include "mojo/runner/register_local_aliases.h"
39 #include "mojo/runner/switches.h" 38 #include "mojo/runner/switches.h"
40 #include "mojo/runner/tracer.h" 39 #include "mojo/runner/tracer.h"
41 #include "mojo/services/tracing/public/cpp/switches.h" 40 #include "mojo/services/tracing/public/cpp/switches.h"
42 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h" 41 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
43 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 42 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
44 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 43 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
45 #include "mojo/shell/application_loader.h" 44 #include "mojo/shell/application_loader.h"
46 #include "mojo/shell/connect_to_application_params.h" 45 #include "mojo/shell/connect_to_application_params.h"
46 #include "mojo/shell/package_manager/package_manager_impl.h"
47 #include "mojo/shell/query_util.h" 47 #include "mojo/shell/query_util.h"
48 #include "mojo/shell/switches.h" 48 #include "mojo/shell/switches.h"
49 #include "mojo/util/filename_util.h" 49 #include "mojo/util/filename_util.h"
50 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 50 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
51 #include "url/gurl.h" 51 #include "url/gurl.h"
52 52
53 namespace mojo { 53 namespace mojo {
54 namespace runner { 54 namespace runner {
55 namespace { 55 namespace {
56 56
57 // Used to ensure we only init once. 57 // Used to ensure we only init once.
58 class Setup { 58 class Setup {
59 public: 59 public:
60 Setup() { 60 Setup() {
61 embedder::PreInitializeParentProcess(); 61 embedder::PreInitializeParentProcess();
62 embedder::Init(); 62 embedder::Init();
63 } 63 }
64 64
65 ~Setup() {} 65 ~Setup() {}
66 66
67 private: 67 private:
68 DISALLOW_COPY_AND_ASSIGN(Setup); 68 DISALLOW_COPY_AND_ASSIGN(Setup);
69 }; 69 };
70 70
71 void InitContentHandlers(package_manager::PackageManagerImpl* manager, 71 void InitContentHandlers(shell::PackageManagerImpl* manager,
72 const base::CommandLine& command_line) { 72 const base::CommandLine& command_line) {
73 // Default content handlers. 73 // Default content handlers.
74 manager->RegisterContentHandler("application/javascript", 74 manager->RegisterContentHandler("application/javascript",
75 GURL("mojo:html_viewer")); 75 GURL("mojo:html_viewer"));
76 manager->RegisterContentHandler("application/pdf", GURL("mojo:pdf_viewer")); 76 manager->RegisterContentHandler("application/pdf", GURL("mojo:pdf_viewer"));
77 manager->RegisterContentHandler("image/gif", GURL("mojo:html_viewer")); 77 manager->RegisterContentHandler("image/gif", GURL("mojo:html_viewer"));
78 manager->RegisterContentHandler("image/jpeg", GURL("mojo:html_viewer")); 78 manager->RegisterContentHandler("image/jpeg", GURL("mojo:html_viewer"));
79 manager->RegisterContentHandler("image/png", GURL("mojo:html_viewer")); 79 manager->RegisterContentHandler("image/png", GURL("mojo:html_viewer"));
80 manager->RegisterContentHandler("text/css", GURL("mojo:html_viewer")); 80 manager->RegisterContentHandler("text/css", GURL("mojo:html_viewer"));
81 manager->RegisterContentHandler("text/html", GURL("mojo:html_viewer")); 81 manager->RegisterContentHandler("text/html", GURL("mojo:html_viewer"));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 EnsureEmbedderIsInitialized(); 211 EnsureEmbedderIsInitialized();
212 task_runners_.reset( 212 task_runners_.reset(
213 new TaskRunners(base::MessageLoop::current()->task_runner())); 213 new TaskRunners(base::MessageLoop::current()->task_runner()));
214 214
215 // TODO(vtl): This should be MASTER, not NONE. 215 // TODO(vtl): This should be MASTER, not NONE.
216 embedder::InitIPCSupport(embedder::ProcessType::NONE, this, 216 embedder::InitIPCSupport(embedder::ProcessType::NONE, this,
217 task_runners_->io_runner(), 217 task_runners_->io_runner(),
218 embedder::ScopedPlatformHandle()); 218 embedder::ScopedPlatformHandle());
219 219
220 package_manager_ = new package_manager::PackageManagerImpl( 220 package_manager_ = new shell::PackageManagerImpl(
221 shell_file_root, task_runners_->blocking_pool()); 221 shell_file_root, task_runners_->blocking_pool());
222 InitContentHandlers(package_manager_, command_line); 222 InitContentHandlers(package_manager_, command_line);
223 223
224 RegisterLocalAliases(package_manager_); 224 RegisterLocalAliases(package_manager_);
225 225
226 scoped_ptr<shell::NativeRunnerFactory> runner_factory; 226 scoped_ptr<shell::NativeRunnerFactory> runner_factory;
227 if (command_line.HasSwitch(switches::kEnableMultiprocess)) { 227 if (command_line.HasSwitch(switches::kEnableMultiprocess)) {
228 runner_factory.reset( 228 runner_factory.reset(
229 new OutOfProcessNativeRunnerFactory(task_runners_->blocking_pool())); 229 new OutOfProcessNativeRunnerFactory(task_runners_->blocking_pool()));
230 } else { 230 } else {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 base::MessageLoop::current()->QuitWhenIdle(); 347 base::MessageLoop::current()->QuitWhenIdle();
348 } else { 348 } else {
349 app_complete_callback_.Run(); 349 app_complete_callback_.Run();
350 } 350 }
351 } 351 }
352 } 352 }
353 } 353 }
354 354
355 } // namespace runner 355 } // namespace runner
356 } // namespace mojo 356 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/context.h ('k') | mojo/runner/register_local_aliases.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698