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

Side by Side Diff: media/blink/new_session_cdm_result_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/blink/new_session_cdm_result_promise.h ('k') | media/cdm/aes_decryptor.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/blink/new_session_cdm_result_promise.h" 5 #include "media/blink/new_session_cdm_result_promise.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/blink/cdm_result_promise_helper.h" 8 #include "media/blink/cdm_result_promise_helper.h"
9 #include "third_party/WebKit/public/platform/WebString.h" 9 #include "third_party/WebKit/public/platform/WebString.h"
10 10
(...skipping 29 matching lines...) Expand all
40 RejectPromiseOnDestruction(); 40 RejectPromiseOnDestruction();
41 } 41 }
42 42
43 void NewSessionCdmResultPromise::resolve(const std::string& session_id) { 43 void NewSessionCdmResultPromise::resolve(const std::string& session_id) {
44 // |new_session_created_cb_| uses a WeakPtr<> and may not do anything 44 // |new_session_created_cb_| uses a WeakPtr<> and may not do anything
45 // if the session object has been destroyed. 45 // if the session object has been destroyed.
46 SessionInitStatus status = SessionInitStatus::UNKNOWN_STATUS; 46 SessionInitStatus status = SessionInitStatus::UNKNOWN_STATUS;
47 new_session_created_cb_.Run(session_id, &status); 47 new_session_created_cb_.Run(session_id, &status);
48 48
49 if (status == SessionInitStatus::UNKNOWN_STATUS) { 49 if (status == SessionInitStatus::UNKNOWN_STATUS) {
50 reject(MediaKeys::INVALID_STATE_ERROR, 0, 50 reject(INVALID_STATE_ERROR, 0, "Cannot finish session initialization");
51 "Cannot finish session initialization");
52 return; 51 return;
53 } 52 }
54 53
55 MarkPromiseSettled(); 54 MarkPromiseSettled();
56 ReportCdmResultUMA(uma_name_, SUCCESS); 55 ReportCdmResultUMA(uma_name_, SUCCESS);
57 web_cdm_result_.completeWithSession(ConvertStatus(status)); 56 web_cdm_result_.completeWithSession(ConvertStatus(status));
58 } 57 }
59 58
60 void NewSessionCdmResultPromise::reject(MediaKeys::Exception exception_code, 59 void NewSessionCdmResultPromise::reject(CdmPromise::Exception exception_code,
61 uint32_t system_code, 60 uint32_t system_code,
62 const std::string& error_message) { 61 const std::string& error_message) {
63 MarkPromiseSettled(); 62 MarkPromiseSettled();
64 ReportCdmResultUMA(uma_name_, 63 ReportCdmResultUMA(uma_name_,
65 ConvertCdmExceptionToResultForUMA(exception_code)); 64 ConvertCdmExceptionToResultForUMA(exception_code));
66 web_cdm_result_.completeWithError(ConvertCdmException(exception_code), 65 web_cdm_result_.completeWithError(ConvertCdmException(exception_code),
67 system_code, 66 system_code,
68 blink::WebString::fromUTF8(error_message)); 67 blink::WebString::fromUTF8(error_message));
69 } 68 }
70 69
71 } // namespace media 70 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/new_session_cdm_result_promise.h ('k') | media/cdm/aes_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698