Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: media/blink/cdm_session_adapter.h

Issue 1072403009: Use std::vector<uint8_t> instead of uint8*/int for MediaKeys interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ 5 #ifndef MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "media/base/media_keys.h" 16 #include "media/base/media_keys.h"
16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" 17 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
17 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h "
18 19
19 class GURL; 20 class GURL;
(...skipping 15 matching lines...) Expand all
35 // via |result|. 36 // via |result|.
36 void CreateCdm(CdmFactory* cdm_factory, 37 void CreateCdm(CdmFactory* cdm_factory,
37 const std::string& key_system, 38 const std::string& key_system,
38 bool allow_distinctive_identifier, 39 bool allow_distinctive_identifier,
39 bool allow_persistent_state, 40 bool allow_persistent_state,
40 const GURL& security_origin, 41 const GURL& security_origin,
41 blink::WebContentDecryptionModuleResult result); 42 blink::WebContentDecryptionModuleResult result);
42 43
43 // Provides a server certificate to be used to encrypt messages to the 44 // Provides a server certificate to be used to encrypt messages to the
44 // license server. 45 // license server.
45 void SetServerCertificate(const uint8* server_certificate, 46 void SetServerCertificate(const std::vector<uint8>& server_certificate,
xhwang 2015/04/21 04:47:11 we use |ceritificate| in MediaKeys... would be gre
jrummell 2015/04/21 22:59:36 Done.
46 int server_certificate_length,
47 scoped_ptr<SimpleCdmPromise> promise); 47 scoped_ptr<SimpleCdmPromise> promise);
48 48
49 // Creates a new session and adds it to the internal map. The caller owns the 49 // Creates a new session and adds it to the internal map. The caller owns the
50 // created session. RemoveSession() must be called when destroying it, if 50 // created session. RemoveSession() must be called when destroying it, if
51 // RegisterSession() was called. 51 // RegisterSession() was called.
52 WebContentDecryptionModuleSessionImpl* CreateSession(); 52 WebContentDecryptionModuleSessionImpl* CreateSession();
53 53
54 // Adds a session to the internal map. Called once the session is successfully 54 // Adds a session to the internal map. Called once the session is successfully
55 // initialized. Returns true if the session was registered, false if there is 55 // initialized. Returns true if the session was registered, false if there is
56 // already an existing session with the same |session_id|. 56 // already an existing session with the same |session_id|.
57 bool RegisterSession( 57 bool RegisterSession(
58 const std::string& session_id, 58 const std::string& session_id,
59 base::WeakPtr<WebContentDecryptionModuleSessionImpl> session); 59 base::WeakPtr<WebContentDecryptionModuleSessionImpl> session);
60 60
61 // Removes a session from the internal map. 61 // Removes a session from the internal map.
62 void UnregisterSession(const std::string& session_id); 62 void UnregisterSession(const std::string& session_id);
63 63
64 // Initializes a session with the |init_data_type|, |init_data| and 64 // Initializes a session with the |init_data_type|, |init_data| and
65 // |session_type| provided. 65 // |session_type| provided.
66 void InitializeNewSession(EmeInitDataType init_data_type, 66 void InitializeNewSession(EmeInitDataType init_data_type,
67 const uint8* init_data, 67 const std::vector<uint8>& init_data,
68 int init_data_length,
69 MediaKeys::SessionType session_type, 68 MediaKeys::SessionType session_type,
70 scoped_ptr<NewSessionCdmPromise> promise); 69 scoped_ptr<NewSessionCdmPromise> promise);
71 70
72 // Loads the session specified by |session_id|. 71 // Loads the session specified by |session_id|.
73 void LoadSession(MediaKeys::SessionType session_type, 72 void LoadSession(MediaKeys::SessionType session_type,
74 const std::string& session_id, 73 const std::string& session_id,
75 scoped_ptr<NewSessionCdmPromise> promise); 74 scoped_ptr<NewSessionCdmPromise> promise);
76 75
77 // Updates the session specified by |session_id| with |response|. 76 // Updates the session specified by |session_id| with |response|.
78 void UpdateSession(const std::string& session_id, 77 void UpdateSession(const std::string& session_id,
79 const uint8* response, 78 const std::vector<uint8>& response,
80 int response_length,
81 scoped_ptr<SimpleCdmPromise> promise); 79 scoped_ptr<SimpleCdmPromise> promise);
82 80
83 // Closes the session specified by |session_id|. 81 // Closes the session specified by |session_id|.
84 void CloseSession(const std::string& session_id, 82 void CloseSession(const std::string& session_id,
85 scoped_ptr<SimpleCdmPromise> promise); 83 scoped_ptr<SimpleCdmPromise> promise);
86 84
87 // Removes stored session data associated with the session specified by 85 // Removes stored session data associated with the session specified by
88 // |session_id|. 86 // |session_id|.
89 void RemoveSession(const std::string& session_id, 87 void RemoveSession(const std::string& session_id,
90 scoped_ptr<SimpleCdmPromise> promise); 88 scoped_ptr<SimpleCdmPromise> promise);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 142
145 // NOTE: Weak pointers must be invalidated before all other member variables. 143 // NOTE: Weak pointers must be invalidated before all other member variables.
146 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; 144 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_;
147 145
148 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); 146 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter);
149 }; 147 };
150 148
151 } // namespace media 149 } // namespace media
152 150
153 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ 151 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698