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

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

Issue 2342953002: Update EME errors to use TypeError (Closed)
Patch Set: changes 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 | « no previous file | media/blink/webcontentdecryptionmodulesession_impl.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/cdm_result_promise_helper.h" 5 #include "media/blink/cdm_result_promise_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 20 matching lines...) Expand all
31 return UNKNOWN_ERROR; 31 return UNKNOWN_ERROR;
32 } 32 }
33 33
34 blink::WebContentDecryptionModuleException ConvertCdmException( 34 blink::WebContentDecryptionModuleException ConvertCdmException(
35 MediaKeys::Exception exception_code) { 35 MediaKeys::Exception exception_code) {
36 switch (exception_code) { 36 switch (exception_code) {
37 case MediaKeys::NOT_SUPPORTED_ERROR: 37 case MediaKeys::NOT_SUPPORTED_ERROR:
38 return blink::WebContentDecryptionModuleExceptionNotSupportedError; 38 return blink::WebContentDecryptionModuleExceptionNotSupportedError;
39 case MediaKeys::INVALID_STATE_ERROR: 39 case MediaKeys::INVALID_STATE_ERROR:
40 return blink::WebContentDecryptionModuleExceptionInvalidStateError; 40 return blink::WebContentDecryptionModuleExceptionInvalidStateError;
41
42 // TODO(jrummell): Since InvalidAccess is not returned, thus should be
43 // renamed to TYPE_ERROR. http://crbug.com/570216#c11.
41 case MediaKeys::INVALID_ACCESS_ERROR: 44 case MediaKeys::INVALID_ACCESS_ERROR:
42 return blink::WebContentDecryptionModuleExceptionInvalidAccessError; 45 return blink::WebContentDecryptionModuleExceptionTypeError;
43 case MediaKeys::QUOTA_EXCEEDED_ERROR: 46 case MediaKeys::QUOTA_EXCEEDED_ERROR:
44 return blink::WebContentDecryptionModuleExceptionQuotaExceededError; 47 return blink::WebContentDecryptionModuleExceptionQuotaExceededError;
45 case MediaKeys::UNKNOWN_ERROR: 48 case MediaKeys::UNKNOWN_ERROR:
46 return blink::WebContentDecryptionModuleExceptionUnknownError; 49 return blink::WebContentDecryptionModuleExceptionUnknownError;
50
51 // These are deprecated, and should be removed.
52 // http://crbug.com/570216#c11.
47 case MediaKeys::CLIENT_ERROR: 53 case MediaKeys::CLIENT_ERROR:
48 return blink::WebContentDecryptionModuleExceptionClientError;
49 case MediaKeys::OUTPUT_ERROR: 54 case MediaKeys::OUTPUT_ERROR:
50 return blink::WebContentDecryptionModuleExceptionOutputError; 55 break;
51 } 56 }
52 NOTREACHED(); 57 NOTREACHED();
53 return blink::WebContentDecryptionModuleExceptionUnknownError; 58 return blink::WebContentDecryptionModuleExceptionUnknownError;
54 } 59 }
55 60
56 void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) { 61 void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) {
57 if (uma_name.empty()) 62 if (uma_name.empty())
58 return; 63 return;
59 64
60 base::LinearHistogram::FactoryGet( 65 base::LinearHistogram::FactoryGet(
61 uma_name, 66 uma_name,
62 1, 67 1,
63 NUM_RESULT_CODES, 68 NUM_RESULT_CODES,
64 NUM_RESULT_CODES + 1, 69 NUM_RESULT_CODES + 1,
65 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result); 70 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result);
66 } 71 }
67 72
68 } // namespace media 73 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/webcontentdecryptionmodulesession_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698