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 "components/html_viewer/html_document.h" | 5 #include "components/html_viewer/html_document.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "components/html_viewer/blink_input_events_type_converters.h" | 15 #include "components/html_viewer/blink_input_events_type_converters.h" |
16 #include "components/html_viewer/blink_url_request_type_converters.h" | 16 #include "components/html_viewer/blink_url_request_type_converters.h" |
17 #include "components/html_viewer/setup.h" | 17 #include "components/html_viewer/setup.h" |
18 #include "components/html_viewer/web_layer_tree_view_impl.h" | 18 #include "components/html_viewer/web_layer_tree_view_impl.h" |
19 #include "components/html_viewer/web_media_player_factory.h" | 19 #include "components/html_viewer/web_media_player_factory.h" |
20 #include "components/html_viewer/web_storage_namespace_impl.h" | 20 #include "components/html_viewer/web_storage_namespace_impl.h" |
21 #include "components/html_viewer/web_url_loader_impl.h" | 21 #include "components/html_viewer/web_url_loader_impl.h" |
22 #include "components/view_manager/public/cpp/view.h" | 22 #include "components/view_manager/public/cpp/view.h" |
23 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | 23 #include "components/view_manager/public/interfaces/surfaces.mojom.h" |
24 #include "media/blink/webencryptedmediaclient_impl.h" | 24 #include "media/blink/webencryptedmediaclient_impl.h" |
25 #include "media/cdm/default_cdm_factory.h" | 25 #include "media/cdm/default_cdm_factory.h" |
26 #include "media/filters/default_media_permission.h" | 26 #include "media/filters/default_media_permission.h" |
| 27 #include "media/mojo/interfaces/content_decryption_module_factory.mojom.h" |
| 28 #include "media/mojo/services/mojo_cdm_factory.h" |
27 #include "mojo/application/public/cpp/application_impl.h" | 29 #include "mojo/application/public/cpp/application_impl.h" |
28 #include "mojo/application/public/cpp/connect.h" | 30 #include "mojo/application/public/cpp/connect.h" |
29 #include "mojo/application/public/interfaces/shell.mojom.h" | 31 #include "mojo/application/public/interfaces/shell.mojom.h" |
30 #include "skia/ext/refptr.h" | 32 #include "skia/ext/refptr.h" |
31 #include "third_party/WebKit/public/platform/Platform.h" | 33 #include "third_party/WebKit/public/platform/Platform.h" |
32 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 34 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
33 #include "third_party/WebKit/public/platform/WebSize.h" | 35 #include "third_party/WebKit/public/platform/WebSize.h" |
34 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 36 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
35 #include "third_party/WebKit/public/web/WebDocument.h" | 37 #include "third_party/WebKit/public/web/WebDocument.h" |
36 #include "third_party/WebKit/public/web/WebElement.h" | 38 #include "third_party/WebKit/public/web/WebElement.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 web_view_->handleInputEvent(*web_event); | 387 web_view_->handleInputEvent(*web_event); |
386 } | 388 } |
387 | 389 |
388 media::MediaPermission* HTMLDocument::GetMediaPermission() { | 390 media::MediaPermission* HTMLDocument::GetMediaPermission() { |
389 if (!media_permission_) | 391 if (!media_permission_) |
390 media_permission_.reset(new media::DefaultMediaPermission(true)); | 392 media_permission_.reset(new media::DefaultMediaPermission(true)); |
391 return media_permission_.get(); | 393 return media_permission_.get(); |
392 } | 394 } |
393 | 395 |
394 media::CdmFactory* HTMLDocument::GetCdmFactory() { | 396 media::CdmFactory* HTMLDocument::GetCdmFactory() { |
395 if (!cdm_factory_) | 397 if (!cdm_factory_) { |
396 cdm_factory_.reset(new media::DefaultCdmFactory()); | 398 if (setup_->enable_mojo_media_renderer()) { |
| 399 ServiceProviderPtr media_service_provider; |
| 400 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 401 request->url = mojo::String::From("mojo:media"); |
| 402 shell_->ConnectToApplication(request.Pass(), |
| 403 GetProxy(&media_service_provider), nullptr); |
| 404 mojo::ContentDecryptionModuleFactoryPtr cdm_factory_ptr; |
| 405 mojo::ConnectToService(media_service_provider.get(), &cdm_factory_ptr); |
| 406 cdm_factory_.reset(new media::MojoCdmFactory(cdm_factory_ptr.Pass())); |
| 407 } else { |
| 408 cdm_factory_.reset(new media::DefaultCdmFactory()); |
| 409 } |
| 410 } |
| 411 |
397 return cdm_factory_.get(); | 412 return cdm_factory_.get(); |
398 } | 413 } |
399 | 414 |
400 } // namespace html_viewer | 415 } // namespace html_viewer |
OLD | NEW |