Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 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/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "media/base/media_keys.h" | 19 #include "media/base/content_decryption_module.h" |
| 20 #include "media/blink/new_session_cdm_result_promise.h" | 20 #include "media/blink/new_session_cdm_result_promise.h" |
| 21 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " | 21 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " |
| 22 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 | 23 |
| 24 namespace media { | 24 namespace media { |
| 25 | 25 |
| 26 class CdmSessionAdapter; | 26 class CdmSessionAdapter; |
| 27 class MediaKeys; | 27 class ContentDecryptionModule; |
|
jrummell
2016/12/12 22:08:40
nit: Not needed as content_decryption_module.h is
xhwang
2016/12/12 22:32:50
Done.
| |
| 28 | 28 |
| 29 class WebContentDecryptionModuleSessionImpl | 29 class WebContentDecryptionModuleSessionImpl |
| 30 : public blink::WebContentDecryptionModuleSession { | 30 : public blink::WebContentDecryptionModuleSession { |
| 31 public: | 31 public: |
| 32 WebContentDecryptionModuleSessionImpl( | 32 WebContentDecryptionModuleSessionImpl( |
| 33 const scoped_refptr<CdmSessionAdapter>& adapter); | 33 const scoped_refptr<CdmSessionAdapter>& adapter); |
| 34 ~WebContentDecryptionModuleSessionImpl() override; | 34 ~WebContentDecryptionModuleSessionImpl() override; |
| 35 | 35 |
| 36 // blink::WebContentDecryptionModuleSession implementation. | 36 // blink::WebContentDecryptionModuleSession implementation. |
| 37 void setClientInterface(Client* client) override; | 37 void setClientInterface(Client* client) override; |
| 38 blink::WebString sessionId() const override; | 38 blink::WebString sessionId() const override; |
| 39 | 39 |
| 40 void initializeNewSession( | 40 void initializeNewSession( |
| 41 blink::WebEncryptedMediaInitDataType init_data_type, | 41 blink::WebEncryptedMediaInitDataType init_data_type, |
| 42 const unsigned char* initData, | 42 const unsigned char* initData, |
| 43 size_t initDataLength, | 43 size_t initDataLength, |
| 44 blink::WebEncryptedMediaSessionType session_type, | 44 blink::WebEncryptedMediaSessionType session_type, |
| 45 blink::WebContentDecryptionModuleResult result) override; | 45 blink::WebContentDecryptionModuleResult result) override; |
| 46 void load(const blink::WebString& session_id, | 46 void load(const blink::WebString& session_id, |
| 47 blink::WebContentDecryptionModuleResult result) override; | 47 blink::WebContentDecryptionModuleResult result) override; |
| 48 void update(const uint8_t* response, | 48 void update(const uint8_t* response, |
| 49 size_t response_length, | 49 size_t response_length, |
| 50 blink::WebContentDecryptionModuleResult result) override; | 50 blink::WebContentDecryptionModuleResult result) override; |
| 51 void close(blink::WebContentDecryptionModuleResult result) override; | 51 void close(blink::WebContentDecryptionModuleResult result) override; |
| 52 void remove(blink::WebContentDecryptionModuleResult result) override; | 52 void remove(blink::WebContentDecryptionModuleResult result) override; |
| 53 | 53 |
| 54 // Callbacks. | 54 // Callbacks. |
| 55 void OnSessionMessage(MediaKeys::MessageType message_type, | 55 void OnSessionMessage(ContentDecryptionModule::MessageType message_type, |
| 56 const std::vector<uint8_t>& message); | 56 const std::vector<uint8_t>& message); |
| 57 void OnSessionKeysChange(bool has_additional_usable_key, | 57 void OnSessionKeysChange(bool has_additional_usable_key, |
| 58 CdmKeysInfo keys_info); | 58 CdmKeysInfo keys_info); |
| 59 void OnSessionExpirationUpdate(base::Time new_expiry_time); | 59 void OnSessionExpirationUpdate(base::Time new_expiry_time); |
| 60 void OnSessionClosed(); | 60 void OnSessionClosed(); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // Called when a new session is created or loaded. |status| is set as | 63 // Called when a new session is created or loaded. |status| is set as |
| 64 // appropriate, depending on whether the session already exists or not. | 64 // appropriate, depending on whether the session already exists or not. |
| 65 void OnSessionInitialized(const std::string& session_id, | 65 void OnSessionInitialized(const std::string& session_id, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 90 // creating a promise in case this class disappears before the promise | 90 // creating a promise in case this class disappears before the promise |
| 91 // actually fires. | 91 // actually fires. |
| 92 base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_; | 92 base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); | 94 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace media | 97 } // namespace media |
| 98 | 98 |
| 99 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 99 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
| OLD | NEW |