blob: a91a123517edc66a55c0ef27ea179301e5849f31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/shell/run.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "mojo/service_manager/service_manager.h"
#include "mojo/shell/context.h"
#include "mojo/shell/keep_alive.h"
#include "mojo/shell/switches.h"
#include "url/gurl.h"
namespace mojo {
namespace shell {
void Run(Context* context) {
KeepAlive keep_alive(context);
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
base::CommandLine::StringVector args = command_line.GetArgs();
if (args.empty()) {
LOG(ERROR) << "No app path specified.";
return;
}
for (base::CommandLine::StringVector::const_iterator it = args.begin();
it != args.end(); ++it) {
GURL url(*it);
if (url.scheme() == "mojo" && !command_line.HasSwitch(switches::kOrigin)) {
LOG(ERROR) << "mojo: url passed with no --origin specified.";
return;
}
ScopedMessagePipeHandle no_handle;
context->service_manager()->ConnectToService(GURL(*it), no_handle.Pass());
}
}
} // namespace shell
} // namespace mojo
|