| 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> | 8 #include <memory> | 
| 9 | 9 | 
| 10 #include "base/lazy_instance.h" |  | 
| 11 #include "base/macros.h" |  | 
| 12 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" | 
| 13 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" | 
| 14 #include "base/time/time.h" | 12 #include "base/time/time.h" | 
| 15 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" | 
| 16 #include "media/base/media_client.h" | 14 #include "media/base/media_client.h" | 
| 17 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR. | 15 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR. | 
| 18 | 16 | 
| 19 namespace content { | 17 namespace content { | 
| 20 | 18 | 
| 21 class CONTENT_EXPORT RenderMediaClient : public media::MediaClient { | 19 class CONTENT_EXPORT RenderMediaClient : public media::MediaClient { | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 32       std::vector<std::unique_ptr<media::KeySystemProperties>>* | 30       std::vector<std::unique_ptr<media::KeySystemProperties>>* | 
| 33           key_systems_properties) final; | 31           key_systems_properties) final; | 
| 34   void RecordRapporURL(const std::string& metric, const GURL& url) final; | 32   void RecordRapporURL(const std::string& metric, const GURL& url) final; | 
| 35   bool IsSupportedVideoConfig(media::VideoCodec codec, | 33   bool IsSupportedVideoConfig(media::VideoCodec codec, | 
| 36                               media::VideoCodecProfile profile, | 34                               media::VideoCodecProfile profile, | 
| 37                               int level) override; | 35                               int level) override; | 
| 38 | 36 | 
| 39   void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); | 37   void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); | 
| 40 | 38 | 
| 41  private: | 39  private: | 
| 42   friend struct base::DefaultLazyInstanceTraits<RenderMediaClient>; | 40   friend class RenderMediaClientTest; | 
| 43 | 41 | 
| 44   RenderMediaClient(); | 42   RenderMediaClient(); | 
| 45   ~RenderMediaClient() override; | 43   ~RenderMediaClient() override; | 
| 46 | 44 | 
|  | 45   static RenderMediaClient* GetInstance(); | 
|  | 46 | 
| 47   // Makes sure all methods are called from the same thread. | 47   // Makes sure all methods are called from the same thread. | 
| 48   base::ThreadChecker thread_checker_; | 48   base::ThreadChecker thread_checker_; | 
| 49 | 49 | 
| 50   // Whether AddSupportedKeySystems() has ever been called. | 50   // Whether AddSupportedKeySystems() has ever been called. | 
| 51   bool has_updated_; | 51   bool has_updated_; | 
| 52 | 52 | 
| 53   // Whether a future update is needed. For example, when some potentially | 53   // Whether a future update is needed. For example, when some potentially | 
| 54   // supported key systems are NOT supported yet. This could happen when the | 54   // supported key systems are NOT supported yet. This could happen when the | 
| 55   // required component for a key system is not yet available. | 55   // required component for a key system is not yet available. | 
| 56   bool is_update_needed_; | 56   bool is_update_needed_; | 
| 57 | 57 | 
| 58   base::TimeTicks last_update_time_ticks_; | 58   base::TimeTicks last_update_time_ticks_; | 
| 59   std::unique_ptr<base::TickClock> tick_clock_; | 59   std::unique_ptr<base::TickClock> tick_clock_; | 
| 60 | 60 | 
| 61   DISALLOW_COPY_AND_ASSIGN(RenderMediaClient); | 61   DISALLOW_COPY_AND_ASSIGN(RenderMediaClient); | 
| 62 }; | 62 }; | 
| 63 | 63 | 
| 64 #if defined(UNIT_TEST) |  | 
| 65 // Helper function to access the RenderMediaClient instance. Used only by unit |  | 
| 66 // tests. |  | 
| 67 CONTENT_EXPORT RenderMediaClient* GetRenderMediaClientInstanceForTesting(); |  | 
| 68 #endif |  | 
| 69 |  | 
| 70 }  // namespace content | 64 }  // namespace content | 
| 71 | 65 | 
| 72 #endif  // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ | 66 #endif  // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_CLIENT_H_ | 
| OLD | NEW | 
|---|