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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 << " [--" << switches::kArgsFor << "=<mojo-app>]" | 75 << " [--" << switches::kArgsFor << "=<mojo-app>]" |
76 << " [--" << switches::kContentHandlers << "=<handlers>]" | 76 << " [--" << switches::kContentHandlers << "=<handlers>]" |
77 << " [--" << switches::kEnableExternalApplications << "]" | 77 << " [--" << switches::kEnableExternalApplications << "]" |
78 << " [--" << switches::kDisableCache << "]" | 78 << " [--" << switches::kDisableCache << "]" |
79 << " [--" << switches::kEnableMultiprocess << "]" | 79 << " [--" << switches::kEnableMultiprocess << "]" |
80 << " [--" << switches::kOrigin << "=<url-lib-path>]" | 80 << " [--" << switches::kOrigin << "=<url-lib-path>]" |
81 << " [--" << switches::kURLMappings << "=from1=to1,from2=to2]" | 81 << " [--" << switches::kURLMappings << "=from1=to1,from2=to2]" |
82 << " <mojo-app> ...\n\n" | 82 << " <mojo-app> ...\n\n" |
83 << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within " | 83 << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within " |
84 << "quotes.\n" | 84 << "quotes.\n" |
85 << "Example: mojo_shell \"mojo://mojo_js_standalone test.js\".\n" | 85 << "Example: mojo_shell \"mojo://js_standalone test.js\".\n" |
86 << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n" | 86 << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n" |
87 << "The value of <handlers> is a comma separated list like:\n" | 87 << "The value of <handlers> is a comma separated list like:\n" |
88 << "text/html,mojo://mojo_html_viewer," | 88 << "text/html,mojo://html_viewer," |
89 << "application/javascript,mojo://mojo_js_content_handler\n"; | 89 << "application/javascript,mojo://js_content_handler\n"; |
90 } | 90 } |
91 | 91 |
92 bool ConfigureURLMappings(const std::string& mappings, | 92 bool ConfigureURLMappings(const std::string& mappings, |
93 mojo::shell::MojoURLResolver* resolver) { | 93 mojo::shell::MojoURLResolver* resolver) { |
94 base::StringPairs pairs; | 94 base::StringPairs pairs; |
95 if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs)) | 95 if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs)) |
96 return false; | 96 return false; |
97 using StringPair = std::pair<std::string, std::string>; | 97 using StringPair = std::pair<std::string, std::string>; |
98 for (const StringPair& pair : pairs) { | 98 for (const StringPair& pair : pairs) { |
99 const GURL from(pair.first); | 99 const GURL from(pair.first); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (kv.first == switches::kArgsFor) | 161 if (kv.first == switches::kArgsFor) |
162 GetAppURLAndSetArgs(kv.second, &shell_context); | 162 GetAppURLAndSetArgs(kv.second, &shell_context); |
163 } | 163 } |
164 | 164 |
165 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); | 165 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); |
166 message_loop.Run(); | 166 message_loop.Run(); |
167 } | 167 } |
168 } | 168 } |
169 return 0; | 169 return 0; |
170 } | 170 } |
OLD | NEW |