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 #ifndef CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ |
7 | 7 |
8 #include <memory> | |
9 | |
10 #include "base/threading/thread_checker.h" | |
11 #include "base/time/tick_clock.h" | |
12 #include "base/time/time.h" | |
13 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
14 #include "media/base/media_client.h" | 9 #include "media/base/media_client.h" |
15 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
16 | 10 |
17 namespace content { | 11 namespace content { |
18 | 12 |
| 13 // RenderMediaClient is purely plumbing to make content embedder customizations |
| 14 // visible to the lower media layer. |
19 class CONTENT_EXPORT RenderMediaClient : public media::MediaClient { | 15 class CONTENT_EXPORT RenderMediaClient : public media::MediaClient { |
20 public: | 16 public: |
21 // Initialize RenderMediaClient and SetMediaClient(). Note that the instance | 17 // Initialize RenderMediaClient and SetMediaClient(). Note that the instance |
22 // is not exposed because no content code needs to directly access it. | 18 // is not exposed because no content code needs to directly access it. |
23 static void Initialize(); | 19 static void Initialize(); |
24 | 20 |
25 // MediaClient implementation. | 21 // MediaClient implementation. |
26 void AddKeySystemsInfoForUMA( | 22 void AddSupportedKeySystems( |
27 std::vector<media::KeySystemInfoForUMA>* key_systems_info_for_uma) final; | 23 std::vector<std::unique_ptr<media::KeySystemProperties>>* key_systems) |
| 24 final; |
28 bool IsKeySystemsUpdateNeeded() final; | 25 bool IsKeySystemsUpdateNeeded() final; |
29 void AddSupportedKeySystems( | 26 bool IsSupportedAudioConfig(const media::AudioConfig& config) final; |
30 std::vector<std::unique_ptr<media::KeySystemProperties>>* | 27 bool IsSupportedVideoConfig(const media::VideoConfig& config) final; |
31 key_systems_properties) final; | |
32 void RecordRapporURL(const std::string& metric, const GURL& url) final; | |
33 bool IsSupportedAudioConfig(const media::AudioConfig& config) override; | |
34 bool IsSupportedVideoConfig(const media::VideoConfig& config) override; | |
35 | |
36 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); | |
37 | 28 |
38 private: | 29 private: |
39 friend class RenderMediaClientTest; | |
40 | |
41 RenderMediaClient(); | 30 RenderMediaClient(); |
42 ~RenderMediaClient() override; | 31 ~RenderMediaClient() override; |
43 | 32 |
44 static RenderMediaClient* GetInstance(); | |
45 | |
46 // Makes sure all methods are called from the same thread. | |
47 base::ThreadChecker thread_checker_; | |
48 | |
49 // Whether AddSupportedKeySystems() has ever been called. | |
50 bool has_updated_; | |
51 | |
52 // Whether a future update is needed. For example, when some potentially | |
53 // supported key systems are NOT supported yet. This could happen when the | |
54 // required component for a key system is not yet available. | |
55 bool is_update_needed_; | |
56 | |
57 base::TimeTicks last_update_time_ticks_; | |
58 std::unique_ptr<base::TickClock> tick_clock_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(RenderMediaClient); | 33 DISALLOW_COPY_AND_ASSIGN(RenderMediaClient); |
61 }; | 34 }; |
62 | 35 |
63 } // namespace content | 36 } // namespace content |
64 | 37 |
65 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ | 38 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ |
OLD | NEW |