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 "mojo/shell/run.h" | 5 #include "mojo/shell/run.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/service_manager/service_manager.h" | 8 #include "mojo/service_manager/service_manager.h" |
9 #include "mojo/shell/context.h" | 9 #include "mojo/shell/context.h" |
10 #include "mojo/shell/keep_alive.h" | 10 #include "mojo/shell/keep_alive.h" |
11 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 namespace shell { | 13 namespace shell { |
14 | 14 |
15 void Run(Context* context, const std::vector<GURL>& app_urls) { | 15 void Run(Context* context, const std::vector<GURL>& app_urls) { |
16 KeepAlive keep_alive(context); | 16 KeepAlive keep_alive(context); |
17 | 17 |
18 if (app_urls.empty()) { | 18 if (app_urls.empty()) { |
19 LOG(ERROR) << "No app path specified"; | 19 LOG(ERROR) << "No app path specified"; |
20 return; | 20 return; |
21 } | 21 } |
22 | 22 |
23 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 23 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
24 it != app_urls.end(); | 24 it != app_urls.end(); |
25 ++it) { | 25 ++it) { |
26 if (it->scheme() == "mojo" && context->mojo_origin().empty()) { | |
27 LOG(ERROR) << "mojo: URL passed with no origin specified"; | |
28 return; | |
29 } | |
30 ScopedMessagePipeHandle no_handle; | 26 ScopedMessagePipeHandle no_handle; |
31 context->service_manager()->ConnectToService( | 27 context->service_manager()->ConnectToService( |
32 *it, std::string(), no_handle.Pass(), GURL()); | 28 *it, std::string(), no_handle.Pass(), GURL()); |
33 } | 29 } |
34 } | 30 } |
35 | 31 |
36 } // namespace shell | 32 } // namespace shell |
37 } // namespace mojo | 33 } // namespace mojo |
OLD | NEW |