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/loader/loader.h" | 10 #include "mojo/loader/loader.h" |
11 #include "mojo/shell/app_container.h" | 11 #include "mojo/shell/app_container.h" |
| 12 #include "mojo/shell/network_delegate.h" |
12 #include "mojo/shell/storage.h" | 13 #include "mojo/shell/storage.h" |
13 #include "mojo/shell/switches.h" | 14 #include "mojo/shell/switches.h" |
14 #include "mojo/shell/task_runners.h" | 15 #include "mojo/shell/task_runners.h" |
15 #include "mojo/system/core_impl.h" | 16 #include "mojo/system/core_impl.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 int main(int argc, char** argv) { | 19 int main(int argc, char** argv) { |
19 base::AtExitManager at_exit; | 20 base::AtExitManager at_exit; |
20 CommandLine::Init(argc, argv); | 21 CommandLine::Init(argc, argv); |
21 | 22 |
22 mojo::system::CoreImpl::Init(); | 23 mojo::system::CoreImpl::Init(); |
23 | 24 |
24 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | 25 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
25 | 26 |
26 // TODO(abarth): Group these objects into a "context" object. | 27 // TODO(abarth): Group these objects into a "context" object. |
27 mojo::shell::TaskRunners task_runners(message_loop.message_loop_proxy()); | 28 mojo::shell::TaskRunners task_runners(message_loop.message_loop_proxy()); |
28 mojo::shell::Storage storage; | 29 mojo::shell::Storage storage; |
29 | 30 |
30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
31 if (!command_line.HasSwitch(switches::kApp)) { | 32 if (!command_line.HasSwitch(switches::kApp)) { |
32 LOG(ERROR) << "No app path specified."; | 33 LOG(ERROR) << "No app path specified."; |
33 return 0; | 34 return 0; |
34 } | 35 } |
35 | 36 |
36 mojo::loader::Loader loader(task_runners.io_runner(), | 37 mojo::loader::Loader loader( |
37 task_runners.file_runner(), | 38 task_runners.io_runner(), |
38 storage.profile_path()); | 39 task_runners.file_runner(), |
| 40 scoped_ptr<net::NetworkDelegate>(new mojo::shell::NetworkDelegate()), |
| 41 storage.profile_path()); |
39 | 42 |
40 scoped_ptr<mojo::shell::AppContainer> container( | 43 scoped_ptr<mojo::shell::AppContainer> container( |
41 new mojo::shell::AppContainer); | 44 new mojo::shell::AppContainer); |
42 | 45 |
43 scoped_ptr<mojo::loader::Job> job = loader.Load( | 46 scoped_ptr<mojo::loader::Job> job = loader.Load( |
44 GURL(command_line.GetSwitchValueASCII(switches::kApp)), | 47 GURL(command_line.GetSwitchValueASCII(switches::kApp)), |
45 container.get()); | 48 container.get()); |
46 | 49 |
47 message_loop.Run(); | 50 message_loop.Run(); |
48 return 0; | 51 return 0; |
49 } | 52 } |
OLD | NEW |