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

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

Issue 1134003009: media: Use mojo::StrongBinding in mojo media services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_demuxer_stream_impl.h » ('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 #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_key_information.h" 8 #include "media/base/cdm_key_information.h"
9 #include "media/base/key_systems.h" 9 #include "media/base/key_systems.h"
10 #include "media/cdm/aes_decryptor.h" 10 #include "media/cdm/aes_decryptor.h"
11 #include "media/mojo/services/media_type_converters.h" 11 #include "media/mojo/services/media_type_converters.h"
12 #include "media/mojo/services/mojo_cdm_promise.h" 12 #include "media/mojo/services/mojo_cdm_promise.h"
13 #include "mojo/common/common_type_converters.h" 13 #include "mojo/common/common_type_converters.h"
14 #include "mojo/common/url_type_converters.h" 14 #include "mojo/common/url_type_converters.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 typedef MojoCdmPromise<> SimpleMojoCdmPromise; 19 typedef MojoCdmPromise<> SimpleMojoCdmPromise;
20 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise; 20 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise;
21 21
22 MojoCdmService::MojoCdmService(const mojo::String& key_system) 22 MojoCdmService::MojoCdmService(
23 : weak_factory_(this) { 23 const mojo::String& key_system,
24 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request)
25 : binding_(this, request.Pass()), weak_factory_(this) {
24 base::WeakPtr<MojoCdmService> weak_this = weak_factory_.GetWeakPtr(); 26 base::WeakPtr<MojoCdmService> weak_this = weak_factory_.GetWeakPtr();
25 27
26 if (CanUseAesDecryptor(key_system)) { 28 if (CanUseAesDecryptor(key_system)) {
27 // TODO(jrummell): Determine proper origin. 29 // TODO(jrummell): Determine proper origin.
28 cdm_.reset(new AesDecryptor( 30 cdm_.reset(new AesDecryptor(
29 GURL::EmptyGURL(), 31 GURL::EmptyGURL(),
30 base::Bind(&MojoCdmService::OnSessionMessage, weak_this), 32 base::Bind(&MojoCdmService::OnSessionMessage, weak_this),
31 base::Bind(&MojoCdmService::OnSessionClosed, weak_this), 33 base::Bind(&MojoCdmService::OnSessionClosed, weak_this),
32 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this))); 34 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this)));
33 } 35 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void MojoCdmService::OnLegacySessionError(const std::string& session_id, 142 void MojoCdmService::OnLegacySessionError(const std::string& session_id,
141 MediaKeys::Exception exception, 143 MediaKeys::Exception exception,
142 uint32_t system_code, 144 uint32_t system_code,
143 const std::string& error_message) { 145 const std::string& error_message) {
144 client_->OnLegacySessionError(session_id, 146 client_->OnLegacySessionError(session_id,
145 static_cast<mojo::CdmException>(exception), 147 static_cast<mojo::CdmException>(exception),
146 system_code, error_message); 148 system_code, error_message);
147 } 149 }
148 150
149 } // namespace media 151 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_demuxer_stream_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698