| 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 CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 5 #ifndef CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| 6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "media/base/browser_cdm.h" | 18 #include "media/base/browser_cdm.h" |
| 19 #include "media/cdm/json_web_key.h" | 19 #include "media/cdm/json_web_key.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class MessageLoopProxy; | 22 class SingleThreadTaskRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 class PlayerTrackerImpl; | 26 class PlayerTrackerImpl; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace chromecast { | 29 namespace chromecast { |
| 30 namespace media { | 30 namespace media { |
| 31 class DecryptContext; | 31 class DecryptContext; |
| 32 | 32 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); | 94 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // BrowserCdm implementation that lives on the UI thread and forwards all calls | 97 // BrowserCdm implementation that lives on the UI thread and forwards all calls |
| 98 // to a BrowserCdmCast instance on the CMA thread. This is used to simplify the | 98 // to a BrowserCdmCast instance on the CMA thread. This is used to simplify the |
| 99 // UI-CMA threading interaction. | 99 // UI-CMA threading interaction. |
| 100 class BrowserCdmCastUi : public ::media::BrowserCdm { | 100 class BrowserCdmCastUi : public ::media::BrowserCdm { |
| 101 public: | 101 public: |
| 102 BrowserCdmCastUi( | 102 BrowserCdmCastUi( |
| 103 scoped_ptr<BrowserCdmCast> browser_cdm_cast, | 103 scoped_ptr<BrowserCdmCast> browser_cdm_cast, |
| 104 const scoped_refptr<base::MessageLoopProxy>& cdm_loop); | 104 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 105 ~BrowserCdmCastUi() override; | 105 ~BrowserCdmCastUi() override; |
| 106 | 106 |
| 107 // PlayerTracker implementation: | 107 // PlayerTracker implementation: |
| 108 int RegisterPlayer(const base::Closure& new_key_cb, | 108 int RegisterPlayer(const base::Closure& new_key_cb, |
| 109 const base::Closure& cdm_unset_cb) override; | 109 const base::Closure& cdm_unset_cb) override; |
| 110 void UnregisterPlayer(int registration_id) override; | 110 void UnregisterPlayer(int registration_id) override; |
| 111 | 111 |
| 112 BrowserCdmCast* browser_cdm_cast() const; | 112 BrowserCdmCast* browser_cdm_cast() const; |
| 113 | 113 |
| 114 private: | 114 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 void UpdateSession(const std::string& session_id, | 127 void UpdateSession(const std::string& session_id, |
| 128 const std::vector<uint8_t>& response, | 128 const std::vector<uint8_t>& response, |
| 129 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 129 scoped_ptr<::media::SimpleCdmPromise> promise) override; |
| 130 void CloseSession(const std::string& session_id, | 130 void CloseSession(const std::string& session_id, |
| 131 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 131 scoped_ptr<::media::SimpleCdmPromise> promise) override; |
| 132 void RemoveSession(const std::string& session_id, | 132 void RemoveSession(const std::string& session_id, |
| 133 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 133 scoped_ptr<::media::SimpleCdmPromise> promise) override; |
| 134 ::media::CdmContext* GetCdmContext() override; | 134 ::media::CdmContext* GetCdmContext() override; |
| 135 | 135 |
| 136 scoped_ptr<BrowserCdmCast> browser_cdm_cast_; | 136 scoped_ptr<BrowserCdmCast> browser_cdm_cast_; |
| 137 scoped_refptr<base::MessageLoopProxy> cdm_loop_; | 137 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 138 | 138 |
| 139 base::ThreadChecker thread_checker_; | 139 base::ThreadChecker thread_checker_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); | 141 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace media | 144 } // namespace media |
| 145 } // namespace chromecast | 145 } // namespace chromecast |
| 146 | 146 |
| 147 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 147 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| OLD | NEW |