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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
15 #include "mojo/edk/embedder/embedder.h" | 15 #include "mojo/edk/embedder/embedder.h" |
16 #include "mojo/edk/embedder/process_delegate.h" | 16 #include "mojo/edk/embedder/process_delegate.h" |
17 #include "mojo/edk/embedder/simple_platform_support.h" | 17 #include "mojo/edk/embedder/simple_platform_support.h" |
18 #include "shell/dynamic_service_runner.h" | 18 #include "shell/dynamic_service_runner.h" |
19 #include "shell/external_application_registrar_connection.h" | 19 #include "shell/external_application_registrar_connection.h" |
20 #include "shell/in_process_dynamic_service_runner.h" | 20 #include "shell/in_process_native_runner.h" |
21 #include "shell/init.h" | 21 #include "shell/init.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 namespace mojo { | 24 namespace mojo { |
25 | 25 |
26 const char kAppArgs[] = "app-args"; | 26 const char kAppArgs[] = "app-args"; |
27 const char kAppPath[] = "app-path"; | 27 const char kAppPath[] = "app-path"; |
28 const char kAppURL[] = "app-url"; | 28 const char kAppURL[] = "app-url"; |
29 const char kShellPath[] = "shell-path"; | 29 const char kShellPath[] = "shell-path"; |
30 | 30 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 connection_->Register( | 64 connection_->Register( |
65 app_url_, app_args_, | 65 app_url_, app_args_, |
66 base::Bind(&Launcher::OnRegistered, base::Unretained(this), | 66 base::Bind(&Launcher::OnRegistered, base::Unretained(this), |
67 base::Unretained(&run_loop))); | 67 base::Unretained(&run_loop))); |
68 run_loop.Run(); | 68 run_loop.Run(); |
69 return application_request_.is_pending(); | 69 return application_request_.is_pending(); |
70 } | 70 } |
71 | 71 |
72 void Run() { | 72 void Run() { |
73 DCHECK(application_request_.is_pending()); | 73 DCHECK(application_request_.is_pending()); |
74 shell::InProcessDynamicServiceRunner service_runner(nullptr); | 74 shell::InProcessNativeRunner service_runner(nullptr); |
75 base::RunLoop run_loop; | 75 base::RunLoop run_loop; |
76 service_runner.Start(app_path_, NativeRunner::DontDeleteAppPath, | 76 service_runner.Start(app_path_, NativeRunner::DontDeleteAppPath, |
77 application_request_.Pass(), run_loop.QuitClosure()); | 77 application_request_.Pass(), run_loop.QuitClosure()); |
78 run_loop.Run(); | 78 run_loop.Run(); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 void OnRegistered(base::RunLoop* run_loop, | 82 void OnRegistered(base::RunLoop* run_loop, |
83 InterfaceRequest<Application> application_request) { | 83 InterfaceRequest<Application> application_request) { |
84 application_request_ = application_request.Pass(); | 84 application_request_ = application_request.Pass(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 if (!launcher.Register()) { | 122 if (!launcher.Register()) { |
123 LOG(ERROR) << "Error registering " | 123 LOG(ERROR) << "Error registering " |
124 << command_line->GetSwitchValueASCII(mojo::kAppURL); | 124 << command_line->GetSwitchValueASCII(mojo::kAppURL); |
125 return 1; | 125 return 1; |
126 } | 126 } |
127 | 127 |
128 launcher.Run(); | 128 launcher.Run(); |
129 return 0; | 129 return 0; |
130 } | 130 } |
OLD | NEW |