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

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

Issue 2444683002: Move MediaKeys::Exception to CdmPromise::Exception (Closed)
Patch Set: include "media/base/media_keys.h" 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
« no previous file with comments | « media/mojo/services/mojo_cdm_promise.h ('k') | media/mojo/services/mojo_cdm_service.cc » ('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"
15 14
16 namespace media { 15 namespace media {
17 16
18 static mojom::CdmPromiseResultPtr GetRejectResult( 17 static mojom::CdmPromiseResultPtr GetRejectResult(
19 MediaKeys::Exception exception, 18 CdmPromise::Exception exception,
20 uint32_t system_code, 19 uint32_t system_code,
21 const std::string& error_message) { 20 const std::string& error_message) {
22 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); 21 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New());
23 cdm_promise_result->success = false; 22 cdm_promise_result->success = false;
24 cdm_promise_result->exception = exception; 23 cdm_promise_result->exception = exception;
25 cdm_promise_result->system_code = system_code; 24 cdm_promise_result->system_code = system_code;
26 cdm_promise_result->error_message = error_message; 25 cdm_promise_result->error_message = error_message;
27 return cdm_promise_result; 26 return cdm_promise_result;
28 } 27 }
29 28
(...skipping 15 matching lines...) Expand all
45 template <typename... T> 44 template <typename... T>
46 void MojoCdmPromise<T...>::resolve(const T&... result) { 45 void MojoCdmPromise<T...>::resolve(const T&... result) {
47 MarkPromiseSettled(); 46 MarkPromiseSettled();
48 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New()); 47 mojom::CdmPromiseResultPtr cdm_promise_result(mojom::CdmPromiseResult::New());
49 cdm_promise_result->success = true; 48 cdm_promise_result->success = true;
50 callback_.Run(std::move(cdm_promise_result), result...); 49 callback_.Run(std::move(cdm_promise_result), result...);
51 callback_.Reset(); 50 callback_.Reset();
52 } 51 }
53 52
54 template <typename... T> 53 template <typename... T>
55 void MojoCdmPromise<T...>::reject(MediaKeys::Exception exception, 54 void MojoCdmPromise<T...>::reject(CdmPromise::Exception exception,
56 uint32_t system_code, 55 uint32_t system_code,
57 const std::string& error_message) { 56 const std::string& error_message) {
58 MarkPromiseSettled(); 57 MarkPromiseSettled();
59 callback_.Run(GetRejectResult(exception, system_code, error_message), T()...); 58 callback_.Run(GetRejectResult(exception, system_code, error_message), T()...);
60 callback_.Reset(); 59 callback_.Reset();
61 } 60 }
62 61
63 template class MojoCdmPromise<>; 62 template class MojoCdmPromise<>;
64 template class MojoCdmPromise<std::string>; 63 template class MojoCdmPromise<std::string>;
65 64
66 } // namespace media 65 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_promise.h ('k') | media/mojo/services/mojo_cdm_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698