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 WebKit::WebContentDecryptionModuleSession { | 24 : public blink::WebContentDecryptionModuleSession { |
25 public: | 25 public: |
26 typedef base::Callback<void(const std::string& session_id)> SessionClosedCB; | 26 typedef base::Callback<void(const std::string& 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 // WebKit::WebContentDecryptionModuleSession implementation. | 34 // blink::WebContentDecryptionModuleSession implementation. |
35 virtual WebKit::WebString sessionId() const OVERRIDE; | 35 virtual blink::WebString sessionId() const OVERRIDE; |
36 virtual void generateKeyRequest(const WebKit::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* key, size_t key_length) OVERRIDE; | 39 virtual void update(const uint8* key, size_t key_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& session_id() const { return session_id_; } |
43 | 43 |
44 // Callbacks. | 44 // Callbacks. |
45 void KeyAdded(); | 45 void KeyAdded(); |
46 void KeyError(media::MediaKeys::KeyError error_code, int system_code); | 46 void KeyError(media::MediaKeys::KeyError error_code, int system_code); |
47 void KeyMessage(const std::vector<uint8>& message, | 47 void KeyMessage(const std::vector<uint8>& message, |
48 const std::string& destination_url); | 48 const std::string& destination_url); |
49 | 49 |
50 private: | 50 private: |
51 // Non-owned pointers. | 51 // Non-owned pointers. |
52 media::MediaKeys* media_keys_; | 52 media::MediaKeys* media_keys_; |
53 Client* client_; | 53 Client* client_; |
54 | 54 |
55 SessionClosedCB session_closed_cb_; | 55 SessionClosedCB session_closed_cb_; |
56 | 56 |
57 std::string session_id_; | 57 std::string session_id_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); | 59 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace content | 62 } // namespace content |
63 | 63 |
64 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ | 64 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_ |
OLD | NEW |