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