OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app/mojo/mojo_init.h" | 5 #include "content/app/mojo/mojo_init.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
13 | 13 |
14 #if defined(MOJO_SHELL_CLIENT) | 14 #if defined(MOJO_SHELL_CLIENT) |
15 #include "content/common/mojo/mojo_shell_connection_impl.h" | 15 #include "content/common/mojo/mojo_shell_connection_impl.h" |
16 #endif | 16 #endif |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class MojoInitializer { | 22 class MojoInitializer { |
23 public: | 23 public: |
24 MojoInitializer() { | 24 MojoInitializer() { |
25 const base::CommandLine& command_line = | 25 const base::CommandLine& command_line = |
26 *base::CommandLine::ForCurrentProcess(); | 26 *base::CommandLine::ForCurrentProcess(); |
27 std::string process_type = | 27 std::string process_type = |
28 command_line.GetSwitchValueASCII(switches::kProcessType); | 28 command_line.GetSwitchValueASCII(switches::kProcessType); |
29 if (0 && process_type.empty() && !command_line.HasSwitch("use-old-edk")) { | 29 if (process_type.empty() && !command_line.HasSwitch("use-old-edk")) { |
30 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 30 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
31 "use-new-edk"); | 31 "use-new-edk"); |
32 } | 32 } |
33 | 33 |
34 if (command_line.HasSwitch("use-new-edk")) { | 34 if (command_line.HasSwitch("use-new-edk")) { |
35 bool initialize_as_parent = process_type.empty(); | 35 bool initialize_as_parent = process_type.empty(); |
36 #if defined(MOJO_SHELL_CLIENT) | 36 #if defined(MOJO_SHELL_CLIENT) |
37 if (IsRunningInMojoShell()) | 37 if (IsRunningInMojoShell()) |
38 initialize_as_parent = false; | 38 initialize_as_parent = false; |
39 #endif | 39 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
51 | 51 |
52 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; | 52 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 void InitializeMojo() { | 56 void InitializeMojo() { |
57 mojo_initializer.Get(); | 57 mojo_initializer.Get(); |
58 } | 58 } |
59 | 59 |
60 } // namespace content | 60 } // namespace content |
OLD | NEW |