Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: mojo/shell/run.cc

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow Android to be built Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/shell/network_delegate.cc ('k') | mojo/shell/service_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "mojo/shell/app_container.h" 10 #include "mojo/shell/context.h"
11 #include "mojo/shell/service_manager.h"
11 #include "mojo/shell/switches.h" 12 #include "mojo/shell/switches.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace shell { 16 namespace shell {
16 17
17 void Run(Context* context) { 18 void Run(Context* context) {
18 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 19 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
19 if (!command_line.HasSwitch(switches::kApp)) { 20 CommandLine::StringVector args = command_line.GetArgs();
21
22 if (args.empty()) {
20 LOG(ERROR) << "No app path specified."; 23 LOG(ERROR) << "No app path specified.";
21 base::MessageLoop::current()->Quit(); 24 base::MessageLoop::current()->Quit();
22 return; 25 return;
23 } 26 }
24 27
25 AppContainer* container = new AppContainer(context); 28 for (CommandLine::StringVector::const_iterator it = args.begin();
26 container->Load(GURL(command_line.GetSwitchValueASCII(switches::kApp))); 29 it != args.end(); ++it) {
27 // TODO(abarth): Currently we leak |container|. 30 GURL url(*it);
31 if (url.scheme() == "mojo" && !command_line.HasSwitch(switches::kOrigin)) {
32 LOG(ERROR) << "mojo: url passed with no --origin specified.";
33 base::MessageLoop::current()->Quit();
34 return;
35 }
36 ScopedMessagePipeHandle no_handle;
37 context->service_manager()->Connect(GURL(*it), no_handle.Pass());
38 }
39 // TODO(davemoore): Currently we leak |service_manager|.
28 } 40 }
29 41
30 } // namespace shell 42 } // namespace shell
31 } // namespace mojo 43 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/network_delegate.cc ('k') | mojo/shell/service_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698