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

Side by Side Diff: media/blink/new_session_cdm_result_promise.cc

Issue 651113002: Move CdmResultPromise to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix template export issue. Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/blink/new_session_cdm_result_promise.h"
6
7 #include "base/logging.h"
8 #include "media/blink/cdm_result_promise_helper.h"
9 #include "third_party/WebKit/public/platform/WebString.h"
10
11 namespace media {
12
13 NewSessionCdmResultPromise::NewSessionCdmResultPromise(
14 const blink::WebContentDecryptionModuleResult& result,
15 const std::string& uma_name,
16 const SessionInitializedCB& new_session_created_cb)
17 : web_cdm_result_(result),
18 uma_name_(uma_name),
19 new_session_created_cb_(new_session_created_cb) {
20 }
21
22 NewSessionCdmResultPromise::~NewSessionCdmResultPromise() {
23 }
24
25 void NewSessionCdmResultPromise::resolve(const std::string& web_session_id) {
26 MarkPromiseSettled();
27 ReportCdmResultUMA(uma_name_, SUCCESS);
28 blink::WebContentDecryptionModuleResult::SessionStatus status =
29 new_session_created_cb_.Run(web_session_id);
30 web_cdm_result_.completeWithSession(status);
31 }
32
33 void NewSessionCdmResultPromise::reject(
34 media::MediaKeys::Exception exception_code,
35 uint32 system_code,
36 const std::string& error_message) {
37 MarkPromiseSettled();
38 ReportCdmResultUMA(uma_name_,
39 ConvertCdmExceptionToResultForUMA(exception_code));
40 web_cdm_result_.completeWithError(ConvertCdmException(exception_code),
41 system_code,
42 blink::WebString::fromUTF8(error_message));
43 }
44
45 } // namespace media
OLDNEW
« media/blink/new_session_cdm_result_promise.h ('K') | « media/blink/new_session_cdm_result_promise.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698