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