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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 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
« no previous file with comments | « media/base/mock_audio_renderer_sink.h ('k') | media/blink/cdm_session_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_t>& certificate,
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_t>& 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_t>& 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 20 matching lines...) Expand all
111 ~CdmSessionAdapter(); 109 ~CdmSessionAdapter();
112 110
113 // Callback for CreateCdm(). 111 // Callback for CreateCdm().
114 void OnCdmCreated(const std::string& key_system, 112 void OnCdmCreated(const std::string& key_system,
115 blink::WebContentDecryptionModuleResult result, 113 blink::WebContentDecryptionModuleResult result,
116 scoped_ptr<MediaKeys> cdm); 114 scoped_ptr<MediaKeys> cdm);
117 115
118 // Callbacks for firing session events. 116 // Callbacks for firing session events.
119 void OnSessionMessage(const std::string& session_id, 117 void OnSessionMessage(const std::string& session_id,
120 MediaKeys::MessageType message_type, 118 MediaKeys::MessageType message_type,
121 const std::vector<uint8>& message, 119 const std::vector<uint8_t>& message,
122 const GURL& legacy_destination_url); 120 const GURL& legacy_destination_url);
123 void OnSessionKeysChange(const std::string& session_id, 121 void OnSessionKeysChange(const std::string& session_id,
124 bool has_additional_usable_key, 122 bool has_additional_usable_key,
125 CdmKeysInfo keys_info); 123 CdmKeysInfo keys_info);
126 void OnSessionExpirationUpdate(const std::string& session_id, 124 void OnSessionExpirationUpdate(const std::string& session_id,
127 const base::Time& new_expiry_time); 125 const base::Time& new_expiry_time);
128 void OnSessionClosed(const std::string& session_id); 126 void OnSessionClosed(const std::string& session_id);
129 void OnLegacySessionError(const std::string& session_id, 127 void OnLegacySessionError(const std::string& session_id,
130 MediaKeys::Exception exception_code, 128 MediaKeys::Exception exception_code,
131 uint32 system_code, 129 uint32_t system_code,
132 const std::string& error_message); 130 const std::string& error_message);
133 131
134 // Helper function of the callbacks. 132 // Helper function of the callbacks.
135 WebContentDecryptionModuleSessionImpl* GetSession( 133 WebContentDecryptionModuleSessionImpl* GetSession(
136 const std::string& session_id); 134 const std::string& session_id);
137 135
138 scoped_ptr<MediaKeys> cdm_; 136 scoped_ptr<MediaKeys> cdm_;
139 137
140 SessionMap sessions_; 138 SessionMap sessions_;
141 139
142 std::string key_system_; 140 std::string key_system_;
143 std::string key_system_uma_prefix_; 141 std::string key_system_uma_prefix_;
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
« no previous file with comments | « media/base/mock_audio_renderer_sink.h ('k') | media/blink/cdm_session_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698