OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef SHELL_COMMAND_LINE_UTIL_H_ | 5 #ifndef SHELL_COMMAND_LINE_UTIL_H_ |
6 #define SHELL_COMMAND_LINE_UTIL_H_ | 6 #define SHELL_COMMAND_LINE_UTIL_H_ |
7 | 7 |
8 #include "shell/context.h" | 8 #include "shell/context.h" |
9 | 9 |
10 namespace mojo { | |
11 namespace shell { | 10 namespace shell { |
12 | 11 |
13 // Parse the given arg, looking for an --args-for switch. If this is not the | 12 // Parse the given arg, looking for an --args-for switch. If this is not the |
14 // case, returns |false|. Otherwise, returns |true| and set |*value| to the | 13 // case, returns |false|. Otherwise, returns |true| and set |*value| to the |
15 // value of the switch. | 14 // value of the switch. |
16 bool ParseArgsFor(const std::string& arg, std::string* value); | 15 bool ParseArgsFor(const std::string& arg, std::string* value); |
17 | 16 |
18 // The value of app_url_and_args is "<mojo_app_url> [<args>...]", where args | 17 // The value of app_url_and_args is "<mojo_app_url> [<args>...]", where args |
19 // is a list of "configuration" arguments separated by spaces. If one or more | 18 // is a list of "configuration" arguments separated by spaces. If one or more |
20 // arguments are specified they will be available when the Mojo application | 19 // arguments are specified they will be available when the Mojo application |
21 // is initialized. This returns the mojo_app_url, and set args to the list of | 20 // is initialized. This returns the mojo_app_url, and set args to the list of |
22 // arguments. | 21 // arguments. |
23 GURL GetAppURLAndArgs(Context* context, | 22 GURL GetAppURLAndArgs(Context* context, |
24 const std::string& app_url_and_args, | 23 const std::string& app_url_and_args, |
25 std::vector<std::string>* args); | 24 std::vector<std::string>* args); |
26 | 25 |
27 // Apply arguments for an application from a line with the following format: | 26 // Apply arguments for an application from a line with the following format: |
28 // '--args-for=application_url arg1 arg2 arg3' | 27 // '--args-for=application_url arg1 arg2 arg3' |
29 // This does nothing if the line has not the right format. | 28 // This does nothing if the line has not the right format. |
30 void ApplyApplicationArgs(Context* context, const std::string& args); | 29 void ApplyApplicationArgs(Context* context, const std::string& args); |
31 | 30 |
32 // Run all application defined on the command line, using the given context. | 31 // Run all application defined on the command line, using the given context. |
33 void RunCommandLineApps(Context* context); | 32 void RunCommandLineApps(Context* context); |
34 | 33 |
35 } // namespace shell | 34 } // namespace shell |
36 } // namespace mojo | |
37 | 35 |
38 #endif // SHELL_COMMAND_LINE_UTIL_H_ | 36 #endif // SHELL_COMMAND_LINE_UTIL_H_ |
OLD | NEW |