OLD | NEW |
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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "mojo/shell/child_process.h" | 10 #include "mojo/shell/child_process.h" |
11 #include "mojo/shell/context.h" | 11 #include "mojo/shell/context.h" |
12 #include "mojo/shell/init.h" | 12 #include "mojo/shell/init.h" |
13 #include "mojo/shell/run.h" | |
14 #include "mojo/shell/switches.h" | 13 #include "mojo/shell/switches.h" |
15 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
16 | 15 |
| 16 namespace { |
| 17 |
| 18 void RunApps(mojo::shell::Context* context, std::vector<GURL> app_urls) { |
| 19 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
| 20 it != app_urls.end(); ++it) { |
| 21 context->Run(*it); |
| 22 } |
| 23 } |
| 24 |
| 25 } // namespace |
| 26 |
17 int main(int argc, char** argv) { | 27 int main(int argc, char** argv) { |
18 base::AtExitManager at_exit; | 28 base::AtExitManager at_exit; |
19 base::CommandLine::Init(argc, argv); | 29 base::CommandLine::Init(argc, argv); |
20 mojo::shell::InitializeLogging(); | 30 mojo::shell::InitializeLogging(); |
21 | 31 |
22 // TODO(vtl): Unify parent and child process cases to the extent possible. | 32 // TODO(vtl): Unify parent and child process cases to the extent possible. |
23 if (scoped_ptr<mojo::shell::ChildProcess> child_process = | 33 if (scoped_ptr<mojo::shell::ChildProcess> child_process = |
24 mojo::shell::ChildProcess::Create( | 34 mojo::shell::ChildProcess::Create( |
25 *base::CommandLine::ForCurrentProcess())) { | 35 *base::CommandLine::ForCurrentProcess())) { |
26 child_process->Main(); | 36 child_process->Main(); |
(...skipping 15 matching lines...) Expand all Loading... |
42 } | 52 } |
43 | 53 |
44 std::vector<GURL> app_urls; | 54 std::vector<GURL> app_urls; |
45 base::CommandLine::StringVector args = command_line.GetArgs(); | 55 base::CommandLine::StringVector args = command_line.GetArgs(); |
46 for (base::CommandLine::StringVector::const_iterator it = args.begin(); | 56 for (base::CommandLine::StringVector::const_iterator it = args.begin(); |
47 it != args.end(); | 57 it != args.end(); |
48 ++it) | 58 ++it) |
49 app_urls.push_back(GURL(*it)); | 59 app_urls.push_back(GURL(*it)); |
50 | 60 |
51 message_loop.PostTask(FROM_HERE, | 61 message_loop.PostTask(FROM_HERE, |
52 base::Bind(mojo::shell::Run, | 62 base::Bind(RunApps, |
53 &shell_context, | 63 &shell_context, |
54 app_urls)); | 64 app_urls)); |
55 message_loop.Run(); | 65 message_loop.Run(); |
56 } | 66 } |
57 } | 67 } |
58 return 0; | 68 return 0; |
59 } | 69 } |
OLD | NEW |