| 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" |
| 11 #include "gin/public/isolate_holder.h" | 11 #include "gin/public/isolate_holder.h" |
| 12 #include "mojo/application/application_runner_chromium.h" | 12 #include "mojo/application/application_runner_chromium.h" |
| 13 #include "mojo/public/c/system/main.h" | 13 #include "mojo/public/c/system/main.h" |
| 14 #include "mojo/public/cpp/application/application_connection.h" | 14 #include "mojo/public/cpp/application/application_connection.h" |
| 15 #include "mojo/public/cpp/application/application_delegate.h" | 15 #include "mojo/public/cpp/application/application_delegate.h" |
| 16 #include "mojo/public/cpp/application/application_impl.h" | 16 #include "mojo/public/cpp/application/application_impl.h" |
| 17 #include "mojo/public/cpp/application/connect.h" | 17 #include "mojo/public/cpp/application/connect.h" |
| 18 #include "mojo/public/cpp/application/interface_factory_impl.h" | 18 #include "mojo/public/cpp/application/interface_factory_impl.h" |
| 19 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" | 19 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" |
| 20 #include "mojo/services/html_viewer/html_document.h" | 20 #include "mojo/services/html_viewer/html_document.h" |
| 21 #include "mojo/services/html_viewer/mojo_blink_platform_impl.h" | 21 #include "mojo/services/html_viewer/mojo_blink_platform_impl.h" |
| 22 #include "mojo/services/html_viewer/webmediaplayer_factory.h" | 22 #include "mojo/services/html_viewer/webmediaplayer_factory.h" |
| 23 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 23 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
| 24 #include "third_party/WebKit/public/web/WebKit.h" | 24 #include "third_party/WebKit/public/web/WebKit.h" |
| 25 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 25 | 26 |
| 26 #if !defined(COMPONENT_BUILD) | 27 #if !defined(COMPONENT_BUILD) |
| 27 #include "base/i18n/icu_util.h" | 28 #include "base/i18n/icu_util.h" |
| 28 #include "base/path_service.h" | 29 #include "base/path_service.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/ui_base_paths.h" | 31 #include "ui/base/ui_base_paths.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 using mojo::ApplicationConnection; | 34 using mojo::ApplicationConnection; |
| 34 using mojo::Array; | 35 using mojo::Array; |
| 35 using mojo::ContentHandler; | 36 using mojo::ContentHandler; |
| 36 using mojo::ServiceProviderPtr; | 37 using mojo::ServiceProviderPtr; |
| 37 using mojo::ShellPtr; | 38 using mojo::ShellPtr; |
| 38 using mojo::String; | 39 using mojo::String; |
| 39 using mojo::URLLoaderPtr; | 40 using mojo::URLLoaderPtr; |
| 40 using mojo::URLResponsePtr; | 41 using mojo::URLResponsePtr; |
| 41 | 42 |
| 42 namespace html_viewer { | 43 namespace html_viewer { |
| 43 | 44 |
| 44 // Switches for html_viewer to be used with "--args-for". For example: | 45 // Switches for html_viewer to be used with "--args-for". For example: |
| 45 // --args-for='mojo:html_viewer --enable-mojo-media-renderer' | 46 // --args-for='mojo:html_viewer --enable-mojo-media-renderer' |
| 46 | 47 |
| 47 // Enable MediaRenderer in media pipeline instead of using the internal | 48 // Enable MediaRenderer in media pipeline instead of using the internal |
| 48 // media::Renderer implementation. | 49 // media::Renderer implementation. |
| 49 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; | 50 const char kEnableMojoMediaRenderer[] = "enable-mojo-media-renderer"; |
| 50 | 51 |
| 52 // Enables support for Encrypted Media Extensions (e.g. MediaKeys). |
| 53 const char kEnableEncryptedMedia[] = "enable-encrypted-media"; |
| 54 |
| 51 class HTMLViewer; | 55 class HTMLViewer; |
| 52 | 56 |
| 53 class HTMLViewerApplication : public mojo::Application { | 57 class HTMLViewerApplication : public mojo::Application { |
| 54 public: | 58 public: |
| 55 HTMLViewerApplication(ShellPtr shell, | 59 HTMLViewerApplication(ShellPtr shell, |
| 56 URLResponsePtr response, | 60 URLResponsePtr response, |
| 57 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 61 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 58 WebMediaPlayerFactory* web_media_player_factory) | 62 WebMediaPlayerFactory* web_media_player_factory) |
| 59 : url_(response->url), | 63 : url_(response->url), |
| 60 shell_(shell.Pass()), | 64 shell_(shell.Pass()), |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 171 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 168 command_line->InitFromArgv(command_line_args); | 172 command_line->InitFromArgv(command_line_args); |
| 169 | 173 |
| 170 logging::LoggingSettings settings; | 174 logging::LoggingSettings settings; |
| 171 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 175 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 172 logging::InitLogging(settings); | 176 logging::InitLogging(settings); |
| 173 | 177 |
| 174 bool enable_mojo_media_renderer = | 178 bool enable_mojo_media_renderer = |
| 175 command_line->HasSwitch(kEnableMojoMediaRenderer); | 179 command_line->HasSwitch(kEnableMojoMediaRenderer); |
| 176 | 180 |
| 181 if (command_line->HasSwitch(kEnableEncryptedMedia)) |
| 182 blink::WebRuntimeFeatures::enableEncryptedMedia(true); |
| 183 |
| 177 compositor_thread_.Start(); | 184 compositor_thread_.Start(); |
| 178 web_media_player_factory_.reset(new WebMediaPlayerFactory( | 185 web_media_player_factory_.reset(new WebMediaPlayerFactory( |
| 179 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer)); | 186 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer)); |
| 180 } | 187 } |
| 181 | 188 |
| 182 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 189 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 183 connection->AddService(this); | 190 connection->AddService(this); |
| 184 return true; | 191 return true; |
| 185 } | 192 } |
| 186 | 193 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 199 | 206 |
| 200 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 207 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
| 201 }; | 208 }; |
| 202 | 209 |
| 203 } // namespace html_viewer | 210 } // namespace html_viewer |
| 204 | 211 |
| 205 MojoResult MojoMain(MojoHandle shell_handle) { | 212 MojoResult MojoMain(MojoHandle shell_handle) { |
| 206 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); | 213 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); |
| 207 return runner.Run(shell_handle); | 214 return runner.Run(shell_handle); |
| 208 } | 215 } |
| OLD | NEW |