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; | |
28 | 27 |
29 class WebContentDecryptionModuleSessionImpl | 28 class WebContentDecryptionModuleSessionImpl |
30 : public blink::WebContentDecryptionModuleSession { | 29 : public blink::WebContentDecryptionModuleSession { |
31 public: | 30 public: |
32 WebContentDecryptionModuleSessionImpl( | 31 WebContentDecryptionModuleSessionImpl( |
33 const scoped_refptr<CdmSessionAdapter>& adapter); | 32 const scoped_refptr<CdmSessionAdapter>& adapter); |
34 ~WebContentDecryptionModuleSessionImpl() override; | 33 ~WebContentDecryptionModuleSessionImpl() override; |
35 | 34 |
36 // blink::WebContentDecryptionModuleSession implementation. | 35 // blink::WebContentDecryptionModuleSession implementation. |
37 void setClientInterface(Client* client) override; | 36 void setClientInterface(Client* client) override; |
38 blink::WebString sessionId() const override; | 37 blink::WebString sessionId() const override; |
39 | 38 |
40 void initializeNewSession( | 39 void initializeNewSession( |
41 blink::WebEncryptedMediaInitDataType init_data_type, | 40 blink::WebEncryptedMediaInitDataType init_data_type, |
42 const unsigned char* initData, | 41 const unsigned char* initData, |
43 size_t initDataLength, | 42 size_t initDataLength, |
44 blink::WebEncryptedMediaSessionType session_type, | 43 blink::WebEncryptedMediaSessionType session_type, |
45 blink::WebContentDecryptionModuleResult result) override; | 44 blink::WebContentDecryptionModuleResult result) override; |
46 void load(const blink::WebString& session_id, | 45 void load(const blink::WebString& session_id, |
47 blink::WebContentDecryptionModuleResult result) override; | 46 blink::WebContentDecryptionModuleResult result) override; |
48 void update(const uint8_t* response, | 47 void update(const uint8_t* response, |
49 size_t response_length, | 48 size_t response_length, |
50 blink::WebContentDecryptionModuleResult result) override; | 49 blink::WebContentDecryptionModuleResult result) override; |
51 void close(blink::WebContentDecryptionModuleResult result) override; | 50 void close(blink::WebContentDecryptionModuleResult result) override; |
52 void remove(blink::WebContentDecryptionModuleResult result) override; | 51 void remove(blink::WebContentDecryptionModuleResult result) override; |
53 | 52 |
54 // Callbacks. | 53 // Callbacks. |
55 void OnSessionMessage(MediaKeys::MessageType message_type, | 54 void OnSessionMessage(ContentDecryptionModule::MessageType message_type, |
56 const std::vector<uint8_t>& message); | 55 const std::vector<uint8_t>& message); |
57 void OnSessionKeysChange(bool has_additional_usable_key, | 56 void OnSessionKeysChange(bool has_additional_usable_key, |
58 CdmKeysInfo keys_info); | 57 CdmKeysInfo keys_info); |
59 void OnSessionExpirationUpdate(base::Time new_expiry_time); | 58 void OnSessionExpirationUpdate(base::Time new_expiry_time); |
60 void OnSessionClosed(); | 59 void OnSessionClosed(); |
61 | 60 |
62 private: | 61 private: |
63 // Called when a new session is created or loaded. |status| is set as | 62 // Called when a new session is created or loaded. |status| is set as |
64 // appropriate, depending on whether the session already exists or not. | 63 // appropriate, depending on whether the session already exists or not. |
65 void OnSessionInitialized(const std::string& session_id, | 64 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 | 89 // creating a promise in case this class disappears before the promise |
91 // actually fires. | 90 // actually fires. |
92 base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_; | 91 base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_; |
93 | 92 |
94 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); | 93 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); |
95 }; | 94 }; |
96 | 95 |
97 } // namespace media | 96 } // namespace media |
98 | 97 |
99 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 98 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
OLD | NEW |