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 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 "media/base/media_keys.h" | 13 #include "media/base/media_keys.h" |
| 14 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " | 14 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " |
| 15 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 class MediaKeys; | 18 class MediaKeys; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 class WebContentDecryptionModuleSessionImpl | 23 class WebContentDecryptionModuleSessionImpl |
| 24 : public blink::WebContentDecryptionModuleSession { | 24 : public blink::WebContentDecryptionModuleSession { |
| 25 public: | 25 public: |
| 26 typedef base::Callback<void(uint32 reference_id)> SessionClosedCB; | 26 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; |
| 27 | 27 |
| 28 WebContentDecryptionModuleSessionImpl( | 28 WebContentDecryptionModuleSessionImpl( |
| 29 media::MediaKeys* media_keys, | 29 media::MediaKeys* media_keys, |
| 30 Client* client, | 30 Client* client, |
| 31 const SessionClosedCB& session_closed_cb); | 31 const SessionClosedCB& session_closed_cb); |
| 32 virtual ~WebContentDecryptionModuleSessionImpl(); | 32 virtual ~WebContentDecryptionModuleSessionImpl(); |
| 33 | 33 |
| 34 // blink::WebContentDecryptionModuleSession implementation. | 34 // blink::WebContentDecryptionModuleSession implementation. |
| 35 virtual blink::WebString sessionId() const OVERRIDE; | 35 virtual blink::WebString sessionId() const OVERRIDE; |
| 36 virtual void generateKeyRequest(const blink::WebString& mime_type, | 36 virtual void generateKeyRequest(const blink::WebString& mime_type, |
| 37 const uint8* init_data, | 37 const uint8* init_data, |
| 38 size_t init_data_length) OVERRIDE; | 38 size_t init_data_length) OVERRIDE; |
| 39 virtual void update(const uint8* response, size_t response_length) OVERRIDE; | 39 virtual void update(const uint8* response, size_t response_length) OVERRIDE; |
| 40 virtual void close() OVERRIDE; | 40 virtual void close() OVERRIDE; |
| 41 | 41 |
| 42 const std::string& session_id() const { return session_id_; } | 42 const std::string& web_session_id() const { return web_session_id_; } |
|
ddorwin
2013/12/05 00:44:52
Because this is so confusing, I think we should ad
ddorwin
2013/12/05 00:44:52
Is anyone using this? If not, remove it. (This is
jrummell
2013/12/06 23:42:35
Not used, so removed.
jrummell
2013/12/06 23:42:35
No longer used.
| |
| 43 | 43 |
| 44 uint32 reference_id() const { return reference_id_; } | 44 uint32 session_id() const { return session_id_; } |
|
ddorwin
2013/12/05 00:44:52
I'd prefer to not have this public session_id(), b
jrummell
2013/12/06 23:42:35
Implemented.
| |
| 45 | 45 |
| 46 // Callbacks. | 46 // Callbacks. |
| 47 void OnSessionCreated(const std::string& session_id); | 47 void OnSessionCreated(const std::string& web_session_id); |
| 48 void OnSessionMessage(const std::vector<uint8>& message, | 48 void OnSessionMessage(const std::vector<uint8>& message, |
| 49 const std::string& destination_url); | 49 const std::string& destination_url); |
| 50 void OnSessionReady(); | 50 void OnSessionReady(); |
| 51 void OnSessionClosed(); | 51 void OnSessionClosed(); |
| 52 void OnSessionError(media::MediaKeys::KeyError error_code, int system_code); | 52 void OnSessionError(media::MediaKeys::KeyError error_code, int system_code); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // Non-owned pointers. | 55 // Non-owned pointers. |
| 56 media::MediaKeys* media_keys_; | 56 media::MediaKeys* media_keys_; |
| 57 Client* client_; | 57 Client* client_; |
| 58 | 58 |
| 59 SessionClosedCB session_closed_cb_; | 59 SessionClosedCB session_closed_cb_; |
| 60 | 60 |
| 61 // Session ID is the user visible ID for this session generated by the CDM. | 61 // Session ID is the user visible ID for this session generated by the CDM. |
|
ddorwin
2013/12/05 00:44:52
Update.
Also, s/user /app-/
jrummell
2013/12/06 23:42:35
Done.
| |
| 62 // This value is not set until the CDM calls OnSessionCreated(). | 62 // This value is not set until the CDM calls OnSessionCreated(). |
| 63 std::string session_id_; | 63 std::string web_session_id_; |
| 64 | 64 |
| 65 // Reference ID is used to uniquely track this object so that CDM callbacks | 65 // Reference ID is used to uniquely track this object so that CDM callbacks |
|
ddorwin
2013/12/05 00:44:52
update
jrummell
2013/12/06 23:42:35
Done.
| |
| 66 // can get routed to the correct object. | 66 // can get routed to the correct object. |
| 67 const uint32 reference_id_; | 67 const uint32 session_id_; |
| 68 | 68 |
| 69 // Reference ID should be unique per renderer process for debugging purposes. | 69 // Reference ID should be unique per renderer process for debugging purposes. |
| 70 static uint32 next_reference_id_; | 70 static uint32 next_session_id_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); | 72 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace content | 75 } // namespace content |
| 76 | 76 |
| 77 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 77 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
| OLD | NEW |