- add sources.
[platform/framework/web/crosswalk.git] / src / mojo / shell / run.cc
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/command_line.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "mojo/shell/app_container.h"
11 #include "mojo/shell/switches.h"
12 #include "url/gurl.h"
13
14 namespace mojo {
15 namespace shell {
16
17 void Run(Context* context) {
18   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
19   if (!command_line.HasSwitch(switches::kApp)) {
20     LOG(ERROR) << "No app path specified.";
21     base::MessageLoop::current()->Quit();
22     return;
23   }
24
25   AppContainer* container = new AppContainer(context);
26   container->Load(GURL(command_line.GetSwitchValueASCII(switches::kApp)));
27   // TODO(abarth): Currently we leak |container|.
28 }
29
30 }  // namespace shell
31 }  // namespace mojo