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

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

Issue 1131753003: Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unittest. 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
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 #include "media/blink/cdm_session_adapter.h" 5 #include "media/blink/cdm_session_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "media/base/cdm_factory.h" 10 #include "media/base/cdm_factory.h"
(...skipping 10 matching lines...) Expand all
21 const char kDot[] = "."; 21 const char kDot[] = ".";
22 22
23 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) { 23 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) {
24 } 24 }
25 25
26 CdmSessionAdapter::~CdmSessionAdapter() {} 26 CdmSessionAdapter::~CdmSessionAdapter() {}
27 27
28 void CdmSessionAdapter::CreateCdm( 28 void CdmSessionAdapter::CreateCdm(
29 CdmFactory* cdm_factory, 29 CdmFactory* cdm_factory,
30 const std::string& key_system, 30 const std::string& key_system,
31 bool allow_distinctive_identifier,
32 bool allow_persistent_state,
33 const GURL& security_origin, 31 const GURL& security_origin,
32 const CdmConfig& cdm_config,
34 blink::WebContentDecryptionModuleResult result) { 33 blink::WebContentDecryptionModuleResult result) {
35 // Note: WebContentDecryptionModuleImpl::Create() calls this method without 34 // Note: WebContentDecryptionModuleImpl::Create() calls this method without
36 // holding a reference to the CdmSessionAdapter. Bind OnCdmCreated() with 35 // holding a reference to the CdmSessionAdapter. Bind OnCdmCreated() with
37 // |this| instead of |weak_this| to prevent |this| from being destructed. 36 // |this| instead of |weak_this| to prevent |this| from being destructed.
38 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); 37 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr();
39 cdm_factory->Create( 38 cdm_factory->Create(
40 key_system, allow_distinctive_identifier, allow_persistent_state, 39 key_system, security_origin, cdm_config,
41 security_origin,
42 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this), 40 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this),
43 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this), 41 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this),
44 base::Bind(&CdmSessionAdapter::OnLegacySessionError, weak_this), 42 base::Bind(&CdmSessionAdapter::OnLegacySessionError, weak_this),
45 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this), 43 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this),
46 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this), 44 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this),
47 base::Bind(&CdmSessionAdapter::OnCdmCreated, this, key_system, result)); 45 base::Bind(&CdmSessionAdapter::OnCdmCreated, this, key_system, result));
48 } 46 }
49 47
50 void CdmSessionAdapter::SetServerCertificate( 48 void CdmSessionAdapter::SetServerCertificate(
51 const std::vector<uint8_t>& certificate, 49 const std::vector<uint8_t>& certificate,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( 189 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession(
192 const std::string& session_id) { 190 const std::string& session_id) {
193 // Since session objects may get garbage collected, it is possible that there 191 // Since session objects may get garbage collected, it is possible that there
194 // are events coming back from the CDM and the session has been unregistered. 192 // are events coming back from the CDM and the session has been unregistered.
195 // We can not tell if the CDM is firing events at sessions that never existed. 193 // We can not tell if the CDM is firing events at sessions that never existed.
196 SessionMap::iterator session = sessions_.find(session_id); 194 SessionMap::iterator session = sessions_.find(session_id);
197 return (session != sessions_.end()) ? session->second.get() : NULL; 195 return (session != sessions_.end()) ? session->second.get() : NULL;
198 } 196 }
199 197
200 } // namespace media 198 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698