| 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/application_manager/application_manager.h" | 8 #include "mojo/application_manager/application_manager.h" |
| 9 #include "mojo/shell/context.h" | 9 #include "mojo/shell/context.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace shell { | 12 namespace shell { |
| 13 | 13 |
| 14 class StubServiceProvider : public InterfaceImpl<ServiceProvider> { | 14 class StubServiceProvider : public InterfaceImpl<ServiceProvider> { |
| 15 private: | 15 private: |
| 16 virtual void ConnectToService(const mojo::String& service_name, | 16 virtual void ConnectToService( |
| 17 ScopedMessagePipeHandle client_handle) | 17 const mojo::String& service_name, |
| 18 MOJO_OVERRIDE { | 18 ScopedMessagePipeHandle client_handle) override {} |
| 19 } | |
| 20 }; | 19 }; |
| 21 | 20 |
| 22 | 21 |
| 23 void Run(Context* context, const std::vector<GURL>& app_urls) { | 22 void Run(Context* context, const std::vector<GURL>& app_urls) { |
| 24 if (app_urls.empty()) { | 23 if (app_urls.empty()) { |
| 25 LOG(ERROR) << "No app path specified"; | 24 LOG(ERROR) << "No app path specified"; |
| 26 return; | 25 return; |
| 27 } | 26 } |
| 28 | 27 |
| 29 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 28 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
| 30 it != app_urls.end(); | 29 it != app_urls.end(); |
| 31 ++it) { | 30 ++it) { |
| 32 // TODO(davemoore): These leak...need refs to them. | 31 // TODO(davemoore): These leak...need refs to them. |
| 33 StubServiceProvider* stub_sp = new StubServiceProvider; | 32 StubServiceProvider* stub_sp = new StubServiceProvider; |
| 34 ServiceProviderPtr spp; | 33 ServiceProviderPtr spp; |
| 35 BindToProxy(stub_sp, &spp); | 34 BindToProxy(stub_sp, &spp); |
| 36 | 35 |
| 37 context->application_manager()->ConnectToApplication( | 36 context->application_manager()->ConnectToApplication( |
| 38 *it, GURL(), spp.Pass()); | 37 *it, GURL(), spp.Pass()); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 | 40 |
| 42 } // namespace shell | 41 } // namespace shell |
| 43 } // namespace mojo | 42 } // namespace mojo |
| OLD | NEW |