| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace html_viewer { | 46 namespace html_viewer { |
| 47 | 47 |
| 48 // Switches for html_viewer to be used with "--args-for". For example: | 48 // Switches for html_viewer to be used with "--args-for". For example: |
| 49 // --args-for='mojo:html_viewer --enable-mojo-media-renderer' | 49 // --args-for='mojo:html_viewer --enable-mojo-media-renderer' |
| 50 | 50 |
| 51 // Enable MediaRenderer in media pipeline instead of using the internal | 51 // Enable MediaRenderer in media pipeline instead of using the internal |
| 52 // media::Renderer implementation. | 52 // media::Renderer implementation. |
| 53 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; | 53 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; |
| 54 | 54 |
| 55 // Enables support for Encrypted Media Extensions (e.g. MediaKeys). | 55 // Disables support for (unprefixed) Encrypted Media Extensions. |
| 56 const char kEnableEncryptedMedia[] = "enable-encrypted-media"; | 56 const char kDisableEncryptedMedia[] = "disable-encrypted-media"; |
| 57 | 57 |
| 58 class HTMLViewer; | 58 class HTMLViewer; |
| 59 | 59 |
| 60 class HTMLViewerApplication : public mojo::Application { | 60 class HTMLViewerApplication : public mojo::Application { |
| 61 public: | 61 public: |
| 62 HTMLViewerApplication(ShellPtr shell, | 62 HTMLViewerApplication(ShellPtr shell, |
| 63 URLResponsePtr response, | 63 URLResponsePtr response, |
| 64 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 64 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 65 WebMediaPlayerFactory* web_media_player_factory) | 65 WebMediaPlayerFactory* web_media_player_factory) |
| 66 : url_(response->url), | 66 : url_(response->url), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 logging::LoggingSettings settings; | 178 logging::LoggingSettings settings; |
| 179 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 179 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 180 logging::InitLogging(settings); | 180 logging::InitLogging(settings); |
| 181 // Display process ID, thread ID and timestamp in logs. | 181 // Display process ID, thread ID and timestamp in logs. |
| 182 logging::SetLogItems(true, true, true, false); | 182 logging::SetLogItems(true, true, true, false); |
| 183 | 183 |
| 184 bool enable_mojo_media_renderer = | 184 bool enable_mojo_media_renderer = |
| 185 command_line->HasSwitch(kEnableMojoMediaRenderer); | 185 command_line->HasSwitch(kEnableMojoMediaRenderer); |
| 186 | 186 |
| 187 if (command_line->HasSwitch(kEnableEncryptedMedia)) | 187 if (command_line->HasSwitch(kDisableEncryptedMedia)) |
| 188 blink::WebRuntimeFeatures::enableEncryptedMedia(true); | 188 blink::WebRuntimeFeatures::enableEncryptedMedia(false); |
| 189 | 189 |
| 190 compositor_thread_.Start(); | 190 compositor_thread_.Start(); |
| 191 web_media_player_factory_.reset(new WebMediaPlayerFactory( | 191 web_media_player_factory_.reset(new WebMediaPlayerFactory( |
| 192 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer)); | 192 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 195 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 196 connection->AddService(this); | 196 connection->AddService(this); |
| 197 return true; | 197 return true; |
| 198 } | 198 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 213 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace html_viewer | 216 } // namespace html_viewer |
| 217 | 217 |
| 218 MojoResult MojoMain(MojoHandle shell_handle) { | 218 MojoResult MojoMain(MojoHandle shell_handle) { |
| 219 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); | 219 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); |
| 220 return runner.Run(shell_handle); | 220 return runner.Run(shell_handle); |
| 221 } | 221 } |
| OLD | NEW |