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

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

Issue 2425663003: media: Use native CDM enum types in media mojo interfaces (Closed)
Patch Set: comments addressed Created 4 years, 2 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/interfaces/typemaps.gni ('k') | media/mojo/services/mojo_cdm_service.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_promise.h" 5 #include "media/mojo/services/mojo_cdm_promise.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "media/base/decryptor.h" 13 #include "media/base/decryptor.h"
14 #include "media/base/media_keys.h" 14 #include "media/base/media_keys.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 static mojom::CdmPromiseResultPtr GetRejectResult( 18 static mojom::CdmPromiseResultPtr GetRejectResult(
19 MediaKeys::Exception exception, 19 MediaKeys::Exception exception,
20 uint32_t system_code, 20 uint32_t system_code,
21 const std::string& error_message) { 21 const std::string& error_message) {
22 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); 22 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New());
23 cdm_promise_result->success = false; 23 cdm_promise_result->success = false;
24 cdm_promise_result->exception = static_cast<mojom::CdmException>(exception); 24 cdm_promise_result->exception = exception;
25 cdm_promise_result->system_code = system_code; 25 cdm_promise_result->system_code = system_code;
26 cdm_promise_result->error_message = error_message; 26 cdm_promise_result->error_message = error_message;
27 return cdm_promise_result; 27 return cdm_promise_result;
28 } 28 }
29 29
30 template <typename... T> 30 template <typename... T>
31 MojoCdmPromise<T...>::MojoCdmPromise(const CallbackType& callback) 31 MojoCdmPromise<T...>::MojoCdmPromise(const CallbackType& callback)
32 : callback_(callback) { 32 : callback_(callback) {
33 DCHECK(!callback_.is_null()); 33 DCHECK(!callback_.is_null());
34 } 34 }
(...skipping 22 matching lines...) Expand all
57 const std::string& error_message) { 57 const std::string& error_message) {
58 MarkPromiseSettled(); 58 MarkPromiseSettled();
59 callback_.Run(GetRejectResult(exception, system_code, error_message), T()...); 59 callback_.Run(GetRejectResult(exception, system_code, error_message), T()...);
60 callback_.Reset(); 60 callback_.Reset();
61 } 61 }
62 62
63 template class MojoCdmPromise<>; 63 template class MojoCdmPromise<>;
64 template class MojoCdmPromise<std::string>; 64 template class MojoCdmPromise<std::string>;
65 65
66 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/interfaces/typemaps.gni ('k') | media/mojo/services/mojo_cdm_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698