OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CDM_SESSION_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
6 #define CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 private: | 77 private: |
78 friend class base::RefCounted<CdmSessionAdapter>; | 78 friend class base::RefCounted<CdmSessionAdapter>; |
79 typedef std::map<uint32, WebContentDecryptionModuleSessionImpl*> SessionMap; | 79 typedef std::map<uint32, WebContentDecryptionModuleSessionImpl*> SessionMap; |
80 | 80 |
81 ~CdmSessionAdapter(); | 81 ~CdmSessionAdapter(); |
82 | 82 |
83 // Callbacks for firing session events. | 83 // Callbacks for firing session events. |
84 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); | 84 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
85 void OnSessionMessage(uint32 session_id, | 85 void OnSessionMessage(uint32 session_id, |
86 const std::vector<uint8>& message, | 86 const std::vector<uint8>& message, |
87 const std::string& destination_url); | 87 const GURL& destination_url); |
88 void OnSessionReady(uint32 session_id); | 88 void OnSessionReady(uint32 session_id); |
89 void OnSessionClosed(uint32 session_id); | 89 void OnSessionClosed(uint32 session_id); |
90 void OnSessionError(uint32 session_id, | 90 void OnSessionError(uint32 session_id, |
91 media::MediaKeys::KeyError error_code, | 91 media::MediaKeys::KeyError error_code, |
92 uint32 system_code); | 92 uint32 system_code); |
93 | 93 |
94 // Helper function of the callbacks. | 94 // Helper function of the callbacks. |
95 WebContentDecryptionModuleSessionImpl* GetSession(uint32 session_id); | 95 WebContentDecryptionModuleSessionImpl* GetSession(uint32 session_id); |
96 | 96 |
97 // Session ID should be unique per renderer process for debugging purposes. | 97 // Session ID should be unique per renderer process for debugging purposes. |
98 static uint32 next_session_id_; | 98 static uint32 next_session_id_; |
99 | 99 |
100 scoped_ptr<media::MediaKeys> media_keys_; | 100 scoped_ptr<media::MediaKeys> media_keys_; |
101 | 101 |
102 SessionMap sessions_; | 102 SessionMap sessions_; |
103 | 103 |
104 #if defined(OS_ANDROID) | 104 #if defined(OS_ANDROID) |
105 int cdm_id_; | 105 int cdm_id_; |
106 #endif | 106 #endif |
107 | 107 |
108 // NOTE: Weak pointers must be invalidated before all other member variables. | 108 // NOTE: Weak pointers must be invalidated before all other member variables. |
109 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 109 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 111 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace content | 114 } // namespace content |
115 | 115 |
116 #endif // CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ | 116 #endif // CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
OLD | NEW |