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