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

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

Issue 2444683002: Move MediaKeys::Exception to CdmPromise::Exception (Closed)
Patch Set: fix for media_remoting_unittests Created 4 years, 1 month 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/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"
xhwang 2016/10/24 17:06:14 remove?
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 CdmPromise::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 = 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
(...skipping 15 matching lines...) Expand all
45 template <typename... T> 45 template <typename... T>
46 void MojoCdmPromise<T...>::resolve(const T&... result) { 46 void MojoCdmPromise<T...>::resolve(const T&... result) {
47 MarkPromiseSettled(); 47 MarkPromiseSettled();
48 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); 48 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New());
49 cdm_promise_result->success = true; 49 cdm_promise_result->success = true;
50 callback_.Run(std::move(cdm_promise_result), result...); 50 callback_.Run(std::move(cdm_promise_result), result...);
51 callback_.Reset(); 51 callback_.Reset();
52 } 52 }
53 53
54 template <typename... T> 54 template <typename... T>
55 void MojoCdmPromise<T...>::reject(MediaKeys::Exception exception, 55 void MojoCdmPromise<T...>::reject(CdmPromise::Exception exception,
56 uint32_t system_code, 56 uint32_t system_code,
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

Powered by Google App Engine
This is Rietveld 408576698