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 CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | |
13 #include "media/base/media_keys.h" | 14 #include "media/base/media_keys.h" |
14 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " | 15 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " |
15 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 class MediaKeys; | 19 class MediaKeys; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
23 class CdmSessionIdAdapter; | |
22 | 24 |
23 class WebContentDecryptionModuleSessionImpl | 25 class WebContentDecryptionModuleSessionImpl |
24 : public blink::WebContentDecryptionModuleSession { | 26 : public blink::WebContentDecryptionModuleSession { |
25 public: | 27 public: |
26 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; | |
27 | |
28 WebContentDecryptionModuleSessionImpl( | 28 WebContentDecryptionModuleSessionImpl( |
29 uint32 session_id, | 29 uint32 session_id, |
30 media::MediaKeys* media_keys, | |
31 Client* client, | 30 Client* client, |
32 const SessionClosedCB& session_closed_cb); | 31 scoped_refptr<CdmSessionIdAdapter> adapter); |
33 virtual ~WebContentDecryptionModuleSessionImpl(); | 32 virtual ~WebContentDecryptionModuleSessionImpl(); |
34 | 33 |
35 // blink::WebContentDecryptionModuleSession implementation. | 34 // blink::WebContentDecryptionModuleSession implementation. |
36 virtual blink::WebString sessionId() const; | 35 virtual blink::WebString sessionId() const; |
37 virtual void initializeNewSession(const blink::WebString& mime_type, | 36 virtual void initializeNewSession(const blink::WebString& mime_type, |
38 const uint8* init_data, | 37 const uint8* init_data, |
39 size_t init_data_length); | 38 size_t init_data_length); |
40 virtual void update(const uint8* response, size_t response_length); | 39 virtual void update(const uint8* response, size_t response_length); |
41 virtual void release(); | 40 virtual void release(); |
42 | 41 |
43 // Callbacks. | 42 // Callbacks. |
44 void OnSessionCreated(const std::string& web_session_id); | 43 void OnSessionCreated(const std::string& web_session_id); |
45 void OnSessionMessage(const std::vector<uint8>& message, | 44 void OnSessionMessage(const std::vector<uint8>& message, |
46 const std::string& destination_url); | 45 const std::string& destination_url); |
47 void OnSessionReady(); | 46 void OnSessionReady(); |
48 void OnSessionClosed(); | 47 void OnSessionClosed(); |
49 void OnSessionError(media::MediaKeys::KeyError error_code, int system_code); | 48 void OnSessionError(media::MediaKeys::KeyError error_code, int system_code); |
50 | 49 |
51 private: | 50 private: |
51 // Owned pointers. | |
ddorwin
2014/02/18 20:59:42
Not owned - ref counted. We don't usually call thi
jrummell
2014/02/19 00:20:29
Done.
| |
52 scoped_refptr<CdmSessionIdAdapter> adapter_; | |
53 | |
52 // Non-owned pointers. | 54 // Non-owned pointers. |
ddorwin
2014/02/18 20:59:42
Remove the 's'
jrummell
2014/02/19 00:20:29
Done.
| |
53 media::MediaKeys* media_keys_; | |
54 Client* client_; | 55 Client* client_; |
55 | 56 |
56 SessionClosedCB session_closed_cb_; | |
57 | |
58 // Web session ID is the app visible ID for this session generated by the CDM. | 57 // Web session ID is the app visible ID for this session generated by the CDM. |
59 // This value is not set until the CDM calls OnSessionCreated(). | 58 // This value is not set until the CDM calls OnSessionCreated(). |
60 blink::WebString web_session_id_; | 59 blink::WebString web_session_id_; |
61 | 60 |
62 // Session ID is used to uniquely track this object so that CDM callbacks | 61 // Session ID is used to uniquely track this object so that CDM callbacks |
63 // can get routed to the correct object. | 62 // can get routed to the correct object. |
64 const uint32 session_id_; | 63 const uint32 session_id_; |
65 | 64 |
66 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); | 65 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); |
67 }; | 66 }; |
68 | 67 |
69 } // namespace content | 68 } // namespace content |
70 | 69 |
71 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 70 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
OLD | NEW |