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

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

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review issues 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
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/service_manager.h"
11 #include "mojo/shell/switches.h" 11 #include "mojo/shell/switches.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace shell { 15 namespace shell {
16 16
17 void Run(Context* context) { 17 void Run(Context* context) {
18 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 18 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
19 if (!command_line.HasSwitch(switches::kApp)) { 19 CommandLine::StringVector args = command_line.GetArgs();
20
21 if (args.size() == 0) {
darin (slow to review) 2013/12/10 06:12:36 nit: "!args.empty()"
DaveMoore 2013/12/11 18:56:44 Done.
20 LOG(ERROR) << "No app path specified."; 22 LOG(ERROR) << "No app path specified.";
21 base::MessageLoop::current()->Quit(); 23 base::MessageLoop::current()->Quit();
22 return; 24 return;
23 } 25 }
24 26
25 AppContainer* container = new AppContainer(context); 27 if (!command_line.HasSwitch(switches::kOrigin)) {
26 container->Load(GURL(command_line.GetSwitchValueASCII(switches::kApp))); 28 LOG(ERROR) << "--origin not specified.";
27 // TODO(abarth): Currently we leak |container|. 29 base::MessageLoop::current()->Quit();
30 return;
31 }
32
33 ServiceManager* service_manager = new ServiceManager(context);
34 for (CommandLine::StringVector::const_iterator it = args.begin();
35 it != args.end(); ++it) {
36 ScopedMessagePipeHandle handle;
darin (slow to review) 2013/12/10 06:12:36 nit: for readability, "handle" -> "no_handle" or "
37 service_manager->Connect(GURL(*it), 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

Powered by Google App Engine
This is Rietveld 408576698