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

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

Issue 985113003: Block platform verification and file IO in the CDM adapter if the CDM configuration disallows them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 10 matching lines...) Expand all
21 const char kMediaEME[] = "Media.EME."; 21 const char kMediaEME[] = "Media.EME.";
22 const char kDot[] = "."; 22 const char kDot[] = ".";
23 23
24 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) { 24 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) {
25 } 25 }
26 26
27 CdmSessionAdapter::~CdmSessionAdapter() {} 27 CdmSessionAdapter::~CdmSessionAdapter() {}
28 28
29 bool CdmSessionAdapter::Initialize(CdmFactory* cdm_factory, 29 bool CdmSessionAdapter::Initialize(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,
31 const GURL& security_origin) { 33 const GURL& security_origin) {
32 key_system_ = key_system; 34 key_system_ = key_system;
33 key_system_uma_prefix_ = 35 key_system_uma_prefix_ =
34 kMediaEME + GetKeySystemNameForUMA(key_system) + kDot; 36 kMediaEME + GetKeySystemNameForUMA(key_system) + kDot;
35 37
36 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); 38 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr();
37 media_keys_ = cdm_factory->Create( 39 media_keys_ = cdm_factory->Create(
38 key_system, security_origin, 40 key_system, allow_distinctive_identifier, allow_persistent_state,
41 security_origin,
39 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this), 42 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this),
40 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this), 43 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this),
41 base::Bind(&CdmSessionAdapter::OnSessionError, weak_this), 44 base::Bind(&CdmSessionAdapter::OnSessionError, weak_this),
42 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this), 45 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this),
43 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this)); 46 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this));
44 return media_keys_.get() != nullptr; 47 return media_keys_.get() != nullptr;
45 } 48 }
46 49
47 void CdmSessionAdapter::SetServerCertificate( 50 void CdmSessionAdapter::SetServerCertificate(
48 const uint8* server_certificate, 51 const uint8* server_certificate,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( 174 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession(
172 const std::string& session_id) { 175 const std::string& session_id) {
173 // Since session objects may get garbage collected, it is possible that there 176 // Since session objects may get garbage collected, it is possible that there
174 // are events coming back from the CDM and the session has been unregistered. 177 // are events coming back from the CDM and the session has been unregistered.
175 // We can not tell if the CDM is firing events at sessions that never existed. 178 // We can not tell if the CDM is firing events at sessions that never existed.
176 SessionMap::iterator session = sessions_.find(session_id); 179 SessionMap::iterator session = sessions_.find(session_id);
177 return (session != sessions_.end()) ? session->second.get() : NULL; 180 return (session != sessions_.end()) ? session->second.get() : NULL;
178 } 181 }
179 182
180 } // namespace media 183 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698