Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / mojo / shell / run.cc
blob3cdb7043f4a9d8b24029cdbc96467bf3c8cd6374
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.
5 #include "mojo/shell/run.h"
7 #include "base/logging.h"
8 #include "mojo/application_manager/application_manager.h"
9 #include "mojo/shell/context.h"
11 namespace mojo {
12 namespace shell {
14 class StubServiceProvider : public InterfaceImpl<ServiceProvider> {
15 private:
16 virtual void ConnectToService(const mojo::String& service_name,
17 ScopedMessagePipeHandle client_handle)
18 MOJO_OVERRIDE {
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;
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);
37 context->application_manager()->ConnectToApplication(
38 *it, GURL(), spp.Pass());
42 } // namespace shell
43 } // namespace mojo