| 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/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.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/app_container.h" | 10 #include "mojo/shell/app_container.h" |
| 11 #include "mojo/shell/storage.h" |
| 11 #include "mojo/shell/switches.h" | 12 #include "mojo/shell/switches.h" |
| 13 #include "mojo/shell/task_runners.h" |
| 12 #include "mojo/system/core_impl.h" | 14 #include "mojo/system/core_impl.h" |
| 13 | 15 |
| 14 int main(int argc, char** argv) { | 16 int main(int argc, char** argv) { |
| 15 base::AtExitManager at_exit; | 17 base::AtExitManager at_exit; |
| 16 CommandLine::Init(argc, argv); | 18 CommandLine::Init(argc, argv); |
| 17 | 19 |
| 18 mojo::system::CoreImpl::Init(); | 20 mojo::system::CoreImpl::Init(); |
| 19 | 21 |
| 20 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | 22 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
| 21 | 23 |
| 24 // TODO(abarth): Group these objects into a "context" object. |
| 25 mojo::shell::TaskRunners task_runners(message_loop.message_loop_proxy()); |
| 26 mojo::shell::Storage storage; |
| 27 |
| 22 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 28 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 23 if (!command_line.HasSwitch(switches::kApp)) { | 29 if (!command_line.HasSwitch(switches::kApp)) { |
| 24 LOG(ERROR) << "No app path specified."; | 30 LOG(ERROR) << "No app path specified."; |
| 25 return 0; | 31 return 0; |
| 26 } | 32 } |
| 27 | 33 |
| 28 scoped_ptr<mojo::shell::AppContainer> container( | 34 scoped_ptr<mojo::shell::AppContainer> container( |
| 29 new mojo::shell::AppContainer); | 35 new mojo::shell::AppContainer); |
| 30 container->LaunchApp(command_line.GetSwitchValuePath(switches::kApp)); | 36 container->LaunchApp(command_line.GetSwitchValuePath(switches::kApp)); |
| 31 message_loop.Run(); | 37 message_loop.Run(); |
| 32 return 0; | 38 return 0; |
| 33 } | 39 } |
| OLD | NEW |