OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <iostream> | 6 #include <iostream> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 << " [--" << switches::kArgsFor << "=<mojo-app>]" | 71 << " [--" << switches::kArgsFor << "=<mojo-app>]" |
72 << " [--" << switches::kContentHandlers << "=<handlers>]" | 72 << " [--" << switches::kContentHandlers << "=<handlers>]" |
73 << " [--" << switches::kEnableExternalApplications << "]" | 73 << " [--" << switches::kEnableExternalApplications << "]" |
74 << " [--" << switches::kDisableCache << "]" | 74 << " [--" << switches::kDisableCache << "]" |
75 << " [--" << switches::kEnableMultiprocess << "]" | 75 << " [--" << switches::kEnableMultiprocess << "]" |
76 << " [--" << switches::kOrigin << "=<url-lib-path>]" | 76 << " [--" << switches::kOrigin << "=<url-lib-path>]" |
77 << " [--" << switches::kURLMappings << "=from1=to1,from2=to2]" | 77 << " [--" << switches::kURLMappings << "=from1=to1,from2=to2]" |
78 << " <mojo-app> ...\n\n" | 78 << " <mojo-app> ...\n\n" |
79 << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within " | 79 << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within " |
80 << "quotes.\n" | 80 << "quotes.\n" |
81 << "Example: mojo_shell \"mojo://js_standalone test.js\".\n" | 81 << "Example: mojo_shell \"mojo:js_standalone test.js\".\n" |
82 << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n" | 82 << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n" |
83 << "The value of <handlers> is a comma separated list like:\n" | 83 << "The value of <handlers> is a comma separated list like:\n" |
84 << "text/html,mojo://html_viewer," | 84 << "text/html,mojo:html_viewer," |
85 << "application/javascript,mojo://js_content_handler\n"; | 85 << "application/javascript,mojo:js_content_handler\n"; |
86 } | 86 } |
87 | 87 |
88 bool ConfigureURLMappings(const std::string& mappings, | 88 bool ConfigureURLMappings(const std::string& mappings, |
89 mojo::shell::MojoURLResolver* resolver) { | 89 mojo::shell::MojoURLResolver* resolver) { |
90 base::StringPairs pairs; | 90 base::StringPairs pairs; |
91 if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs)) | 91 if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs)) |
92 return false; | 92 return false; |
93 using StringPair = std::pair<std::string, std::string>; | 93 using StringPair = std::pair<std::string, std::string>; |
94 for (const StringPair& pair : pairs) { | 94 for (const StringPair& pair : pairs) { |
95 const GURL from(pair.first); | 95 const GURL from(pair.first); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 if (IsArgsFor(argv[i], &args_for_value)) | 174 if (IsArgsFor(argv[i], &args_for_value)) |
175 GetAppURLAndSetArgs(args_for_value, &shell_context); | 175 GetAppURLAndSetArgs(args_for_value, &shell_context); |
176 } | 176 } |
177 | 177 |
178 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); | 178 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); |
179 message_loop.Run(); | 179 message_loop.Run(); |
180 } | 180 } |
181 } | 181 } |
182 return 0; | 182 return 0; |
183 } | 183 } |
OLD | NEW |