| OLD | NEW | 
|   1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2012 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 MEDIA_CRYPTO_DECRYPTOR_CLIENT_H_ |   5 #ifndef MEDIA_BASE_DECRYPTOR_CLIENT_H_ | 
|   6 #define MEDIA_CRYPTO_DECRYPTOR_CLIENT_H_ |   6 #define MEDIA_BASE_DECRYPTOR_CLIENT_H_ | 
|   7  |   7  | 
|   8 #include <string> |   8 #include <string> | 
|   9  |   9  | 
|  10 #include "base/memory/scoped_ptr.h" |  10 #include "base/memory/scoped_ptr.h" | 
|  11 #include "media/crypto/aes_decryptor.h" |  11 #include "media/base/decryptor.h" | 
|  12  |  12  | 
|  13 namespace media { |  13 namespace media { | 
|  14  |  14  | 
|  15 // Interface used by a decryptor to fire key events. |  15 // Interface used by a decryptor to fire key events. | 
|  16 // See: http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-
    media.html#event-summary |  16 // See: http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-
    media.html#event-summary | 
|  17 class DecryptorClient { |  17 class DecryptorClient { | 
|  18  public: |  18  public: | 
|  19   // Signals that a key has been added. |  19   // Signals that a key has been added. | 
|  20   virtual void KeyAdded(const std::string& key_system, |  20   virtual void KeyAdded(const std::string& key_system, | 
|  21                         const std::string& session_id) = 0; |  21                         const std::string& session_id) = 0; | 
|  22  |  22  | 
|  23   // Signals that a key error occurred. The |system_code| is key |  23   // Signals that a key error occurred. The |system_code| is key | 
|  24   // system-dependent. For clear key system, the |system_code| is always zero. |  24   // system-dependent. For clear key system, the |system_code| is always zero. | 
|  25   virtual void KeyError(const std::string& key_system, |  25   virtual void KeyError(const std::string& key_system, | 
|  26                         const std::string& session_id, |  26                         const std::string& session_id, | 
|  27                         AesDecryptor::KeyError error_code, |  27                         Decryptor::KeyError error_code, | 
|  28                         int system_code) = 0; |  28                         int system_code) = 0; | 
|  29  |  29  | 
|  30   // Signals that a key message has been generated. |  30   // Signals that a key message has been generated. | 
|  31   virtual void KeyMessage(const std::string& key_system, |  31   virtual void KeyMessage(const std::string& key_system, | 
|  32                           const std::string& session_id, |  32                           const std::string& session_id, | 
|  33                           scoped_array<uint8> message, |  33                           scoped_array<uint8> message, | 
|  34                           int message_length, |  34                           int message_length, | 
|  35                           const std::string& default_url) = 0; |  35                           const std::string& default_url) = 0; | 
|  36  |  36  | 
|  37   // Signals that a key is needed for decryption. |key_system| and |session_id| |  37   // Signals that a key is needed for decryption. |key_system| and |session_id| | 
|  38   // can be empty if the key system has not been selected. |  38   // can be empty if the key system has not been selected. | 
|  39   virtual void NeedKey(const std::string& key_system, |  39   virtual void NeedKey(const std::string& key_system, | 
|  40                        const std::string& session_id, |  40                        const std::string& session_id, | 
|  41                        scoped_array<uint8> init_data, |  41                        scoped_array<uint8> init_data, | 
|  42                        int init_data_length) = 0; |  42                        int init_data_length) = 0; | 
|  43  |  43  | 
|  44  protected: |  44  protected: | 
|  45   virtual ~DecryptorClient() {} |  45   virtual ~DecryptorClient() {} | 
|  46 }; |  46 }; | 
|  47  |  47  | 
|  48 }  // namespace media |  48 }  // namespace media | 
|  49  |  49  | 
|  50 #endif  // MEDIA_CRYPTO_DECRYPTOR_CLIENT_H_ |  50 #endif  // MEDIA_BASE_DECRYPTOR_CLIENT_H_ | 
| OLD | NEW |