OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_PLAYER_TRACKER_H_ |
| 6 #define MEDIA_BASE_PLAYER_TRACKER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "media/base/media_export.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 // An interface for players to register to be notified when a new decryption key |
| 15 // becomes available or when the CDM is unset. |
| 16 class MEDIA_EXPORT PlayerTracker { |
| 17 public: |
| 18 virtual ~PlayerTracker(); |
| 19 |
| 20 // Registers player callbacks with the CDM. |
| 21 // - |new_key_cb| is fired when a new decryption key becomes available. |
| 22 // - |cdm_unset_cb| is fired when the CDM is detached from the player. |
| 23 // Returns a registration ID which can be used to unregister a player. |
| 24 virtual int RegisterPlayer(const base::Closure& new_key_cb, |
| 25 const base::Closure& cdm_unset_cb) = 0; |
| 26 |
| 27 // Unregisters a previously registered player. This should be called when |
| 28 // the CDM is detached from the player (e.g. setMediaKeys(0)), or when the |
| 29 // player is destroyed. |
| 30 virtual void UnregisterPlayer(int registration_id) = 0; |
| 31 |
| 32 protected: |
| 33 PlayerTracker(); |
| 34 |
| 35 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(PlayerTracker); |
| 37 }; |
| 38 |
| 39 } // namespace media |
| 40 |
| 41 #endif // MEDIA_BASE_PLAYER_TRACKER_H_ |
OLD | NEW |