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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/i18n/icu_util.h" | 6 #include "base/i18n/icu_util.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 using mojo::InterfaceRequest; | 37 using mojo::InterfaceRequest; |
38 using mojo::ServiceProvider; | 38 using mojo::ServiceProvider; |
39 using mojo::ServiceProviderPtr; | 39 using mojo::ServiceProviderPtr; |
40 using mojo::ShellPtr; | 40 using mojo::ShellPtr; |
41 using mojo::String; | 41 using mojo::String; |
42 using mojo::URLLoaderPtr; | 42 using mojo::URLLoaderPtr; |
43 using mojo::URLResponsePtr; | 43 using mojo::URLResponsePtr; |
44 | 44 |
45 namespace html_viewer { | 45 namespace html_viewer { |
46 | 46 |
47 // Switches for html_viewer. | 47 // Switches for html_viewer to be used with "--args-for". For example: |
| 48 // --args-for='mojo:html_viewer --enable-mojo-media-renderer' |
48 | 49 |
49 // Enable MediaRenderer in media pipeline instead of using the internal | 50 // Enable MediaRenderer in media pipeline instead of using the internal |
50 // media::Renderer implementation. | 51 // media::Renderer implementation. |
51 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; | 52 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; |
52 | 53 |
53 // Disables support for (unprefixed) Encrypted Media Extensions. | 54 // Disables support for (unprefixed) Encrypted Media Extensions. |
54 const char kDisableEncryptedMedia[] = "disable-encrypted-media"; | 55 const char kDisableEncryptedMedia[] = "disable-encrypted-media"; |
55 | 56 |
56 // Prevents creation of any output surface. | 57 // Prevents creation of any output surface. |
57 const char kIsHeadless[] = "is-headless"; | 58 const char kIsHeadless[] = "is-headless"; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 blink_platform_.reset(new MojoBlinkPlatformImpl(app)); | 176 blink_platform_.reset(new MojoBlinkPlatformImpl(app)); |
176 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 177 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
177 // Note: this requires file system access. | 178 // Note: this requires file system access. |
178 gin::V8Initializer::LoadV8Snapshot(); | 179 gin::V8Initializer::LoadV8Snapshot(); |
179 #endif | 180 #endif |
180 blink::initialize(blink_platform_.get()); | 181 blink::initialize(blink_platform_.get()); |
181 base::i18n::InitializeICU(); | 182 base::i18n::InitializeICU(); |
182 | 183 |
183 ui::RegisterPathProvider(); | 184 ui::RegisterPathProvider(); |
184 | 185 |
| 186 base::CommandLine::StringVector command_line_args; |
| 187 #if defined(OS_WIN) |
| 188 for (const auto& arg : app->args()) |
| 189 command_line_args.push_back(base::UTF8ToUTF16(arg)); |
| 190 #elif defined(OS_POSIX) |
| 191 command_line_args = app->args(); |
| 192 #endif |
| 193 |
185 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 194 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 195 command_line->InitFromArgv(command_line_args); |
186 | 196 |
187 logging::LoggingSettings settings; | 197 logging::LoggingSettings settings; |
188 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 198 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
189 logging::InitLogging(settings); | 199 logging::InitLogging(settings); |
190 // Display process ID, thread ID and timestamp in logs. | 200 // Display process ID, thread ID and timestamp in logs. |
191 logging::SetLogItems(true, true, true, false); | 201 logging::SetLogItems(true, true, true, false); |
192 | 202 |
193 if (command_line->HasSwitch(kDisableEncryptedMedia)) | 203 if (command_line->HasSwitch(kDisableEncryptedMedia)) |
194 blink::WebRuntimeFeatures::enableEncryptedMedia(false); | 204 blink::WebRuntimeFeatures::enableEncryptedMedia(false); |
195 | 205 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 255 |
246 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 256 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
247 }; | 257 }; |
248 | 258 |
249 } // namespace html_viewer | 259 } // namespace html_viewer |
250 | 260 |
251 MojoResult MojoMain(MojoHandle shell_handle) { | 261 MojoResult MojoMain(MojoHandle shell_handle) { |
252 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); | 262 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); |
253 return runner.Run(shell_handle); | 263 return runner.Run(shell_handle); |
254 } | 264 } |
OLD | NEW |