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

Side by Side Diff: media/mojo/services/mojo_cdm_service.cc

Issue 1227883002: media: Pass CdmConfig in mojo CDM interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase-only Created 5 years, 5 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/mojo/services/mojo_cdm_service.h ('k') | no next file » | 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 #include "media/mojo/services/mojo_cdm_service.h" 5 #include "media/mojo/services/mojo_cdm_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "media/base/cdm_config.h" 8 #include "media/base/cdm_config.h"
9 #include "media/base/cdm_factory.h" 9 #include "media/base/cdm_factory.h"
10 #include "media/base/cdm_key_information.h" 10 #include "media/base/cdm_key_information.h"
(...skipping 29 matching lines...) Expand all
40 context_->UnregisterCdm(cdm_id_); 40 context_->UnregisterCdm(cdm_id_);
41 } 41 }
42 42
43 void MojoCdmService::SetClient(mojo::ContentDecryptionModuleClientPtr client) { 43 void MojoCdmService::SetClient(mojo::ContentDecryptionModuleClientPtr client) {
44 client_ = client.Pass(); 44 client_ = client.Pass();
45 } 45 }
46 46
47 void MojoCdmService::Initialize( 47 void MojoCdmService::Initialize(
48 const mojo::String& key_system, 48 const mojo::String& key_system,
49 const mojo::String& security_origin, 49 const mojo::String& security_origin,
50 mojo::CdmConfigPtr cdm_config,
50 int32_t cdm_id, 51 int32_t cdm_id,
51 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) { 52 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) {
52 DVLOG(1) << __FUNCTION__ << ": " << key_system; 53 DVLOG(1) << __FUNCTION__ << ": " << key_system;
53 DCHECK(!cdm_); 54 DCHECK(!cdm_);
54 DCHECK_NE(CdmContext::kInvalidCdmId, cdm_id); 55 DCHECK_NE(CdmContext::kInvalidCdmId, cdm_id);
55 56
56 auto weak_this = weak_factory_.GetWeakPtr(); 57 auto weak_this = weak_factory_.GetWeakPtr();
57 cdm_factory_->Create( 58 cdm_factory_->Create(
58 key_system, GURL(security_origin), CdmConfig(), 59 key_system, GURL(security_origin), cdm_config.To<CdmConfig>(),
59 base::Bind(&MojoCdmService::OnSessionMessage, weak_this), 60 base::Bind(&MojoCdmService::OnSessionMessage, weak_this),
60 base::Bind(&MojoCdmService::OnSessionClosed, weak_this), 61 base::Bind(&MojoCdmService::OnSessionClosed, weak_this),
61 base::Bind(&MojoCdmService::OnLegacySessionError, weak_this), 62 base::Bind(&MojoCdmService::OnLegacySessionError, weak_this),
62 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this), 63 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this),
63 base::Bind(&MojoCdmService::OnSessionExpirationUpdate, weak_this), 64 base::Bind(&MojoCdmService::OnSessionExpirationUpdate, weak_this),
64 base::Bind( 65 base::Bind(
65 &MojoCdmService::OnCdmCreated, weak_this, cdm_id, 66 &MojoCdmService::OnCdmCreated, weak_this, cdm_id,
66 base::Passed(make_scoped_ptr(new SimpleMojoCdmPromise(callback))))); 67 base::Passed(make_scoped_ptr(new SimpleMojoCdmPromise(callback)))));
67 } 68 }
68 69
69 // mojo::MediaRenderer implementation.
70 void MojoCdmService::SetServerCertificate( 70 void MojoCdmService::SetServerCertificate(
71 mojo::Array<uint8_t> certificate_data, 71 mojo::Array<uint8_t> certificate_data,
72 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) { 72 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) {
73 DVLOG(2) << __FUNCTION__; 73 DVLOG(2) << __FUNCTION__;
74 cdm_->SetServerCertificate( 74 cdm_->SetServerCertificate(
75 certificate_data.storage(), 75 certificate_data.storage(),
76 make_scoped_ptr(new SimpleMojoCdmPromise(callback))); 76 make_scoped_ptr(new SimpleMojoCdmPromise(callback)));
77 } 77 }
78 78
79 void MojoCdmService::CreateSessionAndGenerateRequest( 79 void MojoCdmService::CreateSessionAndGenerateRequest(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 MediaKeys::Exception exception, 191 MediaKeys::Exception exception,
192 uint32_t system_code, 192 uint32_t system_code,
193 const std::string& error_message) { 193 const std::string& error_message) {
194 DVLOG(2) << __FUNCTION__; 194 DVLOG(2) << __FUNCTION__;
195 client_->OnLegacySessionError(session_id, 195 client_->OnLegacySessionError(session_id,
196 static_cast<mojo::CdmException>(exception), 196 static_cast<mojo::CdmException>(exception),
197 system_code, error_message); 197 system_code, error_message);
198 } 198 }
199 199
200 } // namespace media 200 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698