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 "content/renderer/media/render_media_client.h" | 5 #include "content/renderer/media/render_media_client.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
11 #include "content/public/renderer/content_renderer_client.h" | 11 #include "content/public/renderer/content_renderer_client.h" |
12 #include "media/base/key_system_info.h" | |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 | 14 |
16 static base::LazyInstance<RenderMediaClient>::Leaky g_render_media_client = | 15 static base::LazyInstance<RenderMediaClient>::Leaky g_render_media_client = |
17 LAZY_INSTANCE_INITIALIZER; | 16 LAZY_INSTANCE_INITIALIZER; |
18 | 17 |
19 void RenderMediaClient::Initialize() { | 18 void RenderMediaClient::Initialize() { |
20 g_render_media_client.Get(); | 19 g_render_media_client.Get(); |
21 } | 20 } |
22 | 21 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 63 |
65 return true; | 64 return true; |
66 } | 65 } |
67 | 66 |
68 void RenderMediaClient::AddSupportedKeySystems( | 67 void RenderMediaClient::AddSupportedKeySystems( |
69 std::vector<std::unique_ptr<media::KeySystemProperties>>* | 68 std::vector<std::unique_ptr<media::KeySystemProperties>>* |
70 key_systems_properties) { | 69 key_systems_properties) { |
71 DVLOG(2) << __FUNCTION__; | 70 DVLOG(2) << __FUNCTION__; |
72 DCHECK(thread_checker_.CalledOnValidThread()); | 71 DCHECK(thread_checker_.CalledOnValidThread()); |
73 | 72 |
74 std::vector<media::KeySystemInfo> key_systems_info; | |
75 GetContentClient()->renderer()->AddKeySystems(&key_systems_info); | |
76 for (const auto& info : key_systems_info) { | |
77 key_systems_properties->emplace_back( | |
78 new media::InfoBasedKeySystemProperties(info)); | |
79 } | |
80 GetContentClient()->renderer()->AddSupportedKeySystems( | 73 GetContentClient()->renderer()->AddSupportedKeySystems( |
81 key_systems_properties); | 74 key_systems_properties); |
82 | 75 |
83 has_updated_ = true; | 76 has_updated_ = true; |
84 last_update_time_ticks_ = tick_clock_->NowTicks(); | 77 last_update_time_ticks_ = tick_clock_->NowTicks(); |
85 | 78 |
86 // Check whether all potentially supported key systems are supported. If so, | 79 // Check whether all potentially supported key systems are supported. If so, |
87 // no need to update again. | 80 // no need to update again. |
88 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 81 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
89 for (const auto& properties : *key_systems_properties) { | 82 for (const auto& properties : *key_systems_properties) { |
(...skipping 18 matching lines...) Expand all Loading... |
108 // This functions is for testing purpose only. The declaration in the | 101 // This functions is for testing purpose only. The declaration in the |
109 // header file is guarded by "#if defined(UNIT_TEST)" so that it can be used | 102 // header file is guarded by "#if defined(UNIT_TEST)" so that it can be used |
110 // by tests but not non-test code. However, this .cc file is compiled as part of | 103 // by tests but not non-test code. However, this .cc file is compiled as part of |
111 // "content" where "UNIT_TEST" is not defined. So we need to specify | 104 // "content" where "UNIT_TEST" is not defined. So we need to specify |
112 // "CONTENT_EXPORT" here again so that it is visible to tests. | 105 // "CONTENT_EXPORT" here again so that it is visible to tests. |
113 CONTENT_EXPORT RenderMediaClient* GetRenderMediaClientInstanceForTesting() { | 106 CONTENT_EXPORT RenderMediaClient* GetRenderMediaClientInstanceForTesting() { |
114 return g_render_media_client.Pointer(); | 107 return g_render_media_client.Pointer(); |
115 } | 108 } |
116 | 109 |
117 } // namespace content | 110 } // namespace content |
OLD | NEW |