| 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/command_line.h" | 7 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/public/cpp/environment/environment.h" | 10 #include "mojo/public/cpp/environment/environment.h" |
| 10 #include "mojo/shell/child_process.h" | 11 #include "mojo/shell/child_process.h" |
| 11 #include "mojo/shell/context.h" | 12 #include "mojo/shell/context.h" |
| 12 #include "mojo/shell/init.h" | 13 #include "mojo/shell/init.h" |
| 13 #include "mojo/shell/run.h" | 14 #include "mojo/shell/run.h" |
| 14 #include "mojo/shell/switches.h" | 15 #include "mojo/shell/switches.h" |
| 15 #include "ui/gl/gl_surface.h" | 16 #include "ui/gl/gl_surface.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 27 child_process->Main(); | 28 child_process->Main(); |
| 28 } else { | 29 } else { |
| 29 gfx::GLSurface::InitializeOneOff(); | 30 gfx::GLSurface::InitializeOneOff(); |
| 30 | 31 |
| 31 base::MessageLoop message_loop; | 32 base::MessageLoop message_loop; |
| 32 mojo::shell::Context shell_context; | 33 mojo::shell::Context shell_context; |
| 33 | 34 |
| 34 const base::CommandLine& command_line = | 35 const base::CommandLine& command_line = |
| 35 *base::CommandLine::ForCurrentProcess(); | 36 *base::CommandLine::ForCurrentProcess(); |
| 36 if (command_line.HasSwitch(switches::kOrigin)) { | 37 if (command_line.HasSwitch(switches::kOrigin)) { |
| 37 shell_context.set_mojo_origin( | 38 shell_context.mojo_url_resolver()->set_origin( |
| 38 command_line.GetSwitchValueASCII(switches::kOrigin)); | 39 command_line.GetSwitchValueASCII(switches::kOrigin)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 std::vector<GURL> app_urls; | 42 std::vector<GURL> app_urls; |
| 42 base::CommandLine::StringVector args = command_line.GetArgs(); | 43 base::CommandLine::StringVector args = command_line.GetArgs(); |
| 43 for (base::CommandLine::StringVector::const_iterator it = args.begin(); | 44 for (base::CommandLine::StringVector::const_iterator it = args.begin(); |
| 44 it != args.end(); | 45 it != args.end(); |
| 45 ++it) | 46 ++it) |
| 46 app_urls.push_back(GURL(*it)); | 47 app_urls.push_back(GURL(*it)); |
| 47 | 48 |
| 48 message_loop.PostTask(FROM_HERE, | 49 message_loop.PostTask(FROM_HERE, |
| 49 base::Bind(mojo::shell::Run, | 50 base::Bind(mojo::shell::Run, |
| 50 &shell_context, | 51 &shell_context, |
| 51 app_urls)); | 52 app_urls)); |
| 52 | 53 |
| 53 message_loop.Run(); | 54 message_loop.Run(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 return 0; | 57 return 0; |
| 57 } | 58 } |
| OLD | NEW |