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

Side by Side Diff: chrome/renderer/media/chrome_key_systems.cc

Issue 2582463003: media: Verify CDM Host files (Closed)
Patch Set: comments addressed Created 3 years, 11 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/media/chrome_key_systems.h" 5 #include "chrome/renderer/media/chrome_key_systems.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 &is_available, 55 &is_available,
56 additional_param_names, 56 additional_param_names,
57 additional_param_values)); 57 additional_param_values));
58 58
59 return is_available; 59 return is_available;
60 } 60 }
61 61
62 // External Clear Key (used for testing). 62 // External Clear Key (used for testing).
63 static void AddExternalClearKey( 63 static void AddExternalClearKey(
64 std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) { 64 std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) {
65 // TODO(xhwang): Move these into an array so we can use a for loop to add
66 // supported key systems below.
65 static const char kExternalClearKeyKeySystem[] = 67 static const char kExternalClearKeyKeySystem[] =
66 "org.chromium.externalclearkey"; 68 "org.chromium.externalclearkey";
67 static const char kExternalClearKeyDecryptOnlyKeySystem[] = 69 static const char kExternalClearKeyDecryptOnlyKeySystem[] =
68 "org.chromium.externalclearkey.decryptonly"; 70 "org.chromium.externalclearkey.decryptonly";
69 static const char kExternalClearKeyRenewalKeySystem[] = 71 static const char kExternalClearKeyRenewalKeySystem[] =
70 "org.chromium.externalclearkey.renewal"; 72 "org.chromium.externalclearkey.renewal";
71 static const char kExternalClearKeyFileIOTestKeySystem[] = 73 static const char kExternalClearKeyFileIOTestKeySystem[] =
72 "org.chromium.externalclearkey.fileiotest"; 74 "org.chromium.externalclearkey.fileiotest";
73 static const char kExternalClearKeyOutputProtectionTestKeySystem[] = 75 static const char kExternalClearKeyOutputProtectionTestKeySystem[] =
74 "org.chromium.externalclearkey.outputprotectiontest"; 76 "org.chromium.externalclearkey.outputprotectiontest";
75 static const char kExternalClearKeyPlatformVerificationTestKeySystem[] = 77 static const char kExternalClearKeyPlatformVerificationTestKeySystem[] =
76 "org.chromium.externalclearkey.platformverificationtest"; 78 "org.chromium.externalclearkey.platformverificationtest";
77 static const char kExternalClearKeyInitializeFailKeySystem[] = 79 static const char kExternalClearKeyInitializeFailKeySystem[] =
78 "org.chromium.externalclearkey.initializefail"; 80 "org.chromium.externalclearkey.initializefail";
79 static const char kExternalClearKeyCrashKeySystem[] = 81 static const char kExternalClearKeyCrashKeySystem[] =
80 "org.chromium.externalclearkey.crash"; 82 "org.chromium.externalclearkey.crash";
83 static const char kExternalClearKeyVerifyCdmHostTestKeySystem[] =
84 "org.chromium.externalclearkey.verifycdmhosttest";
81 85
82 std::vector<base::string16> additional_param_names; 86 std::vector<base::string16> additional_param_names;
83 std::vector<base::string16> additional_param_values; 87 std::vector<base::string16> additional_param_values;
84 if (!IsPepperCdmAvailable(cdm::kExternalClearKeyPepperType, 88 if (!IsPepperCdmAvailable(cdm::kExternalClearKeyPepperType,
85 &additional_param_names, 89 &additional_param_names,
86 &additional_param_values)) { 90 &additional_param_values)) {
87 return; 91 return;
88 } 92 }
89 93
90 concrete_key_systems->emplace_back( 94 concrete_key_systems->emplace_back(
(...skipping 21 matching lines...) Expand all
112 116
113 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually 117 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually
114 // will be refused by ClearKeyCdm. This is to test the CDM initialization 118 // will be refused by ClearKeyCdm. This is to test the CDM initialization
115 // failure case. 119 // failure case.
116 concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( 120 concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties(
117 kExternalClearKeyInitializeFailKeySystem)); 121 kExternalClearKeyInitializeFailKeySystem));
118 122
119 // A key system that triggers a crash in ClearKeyCdm. 123 // A key system that triggers a crash in ClearKeyCdm.
120 concrete_key_systems->emplace_back( 124 concrete_key_systems->emplace_back(
121 new cdm::ExternalClearKeyProperties(kExternalClearKeyCrashKeySystem)); 125 new cdm::ExternalClearKeyProperties(kExternalClearKeyCrashKeySystem));
126
127 // A key system that triggers the verify host files test in ClearKeyCdm.
128 concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties(
129 kExternalClearKeyVerifyCdmHostTestKeySystem));
122 } 130 }
123 131
124 #if defined(WIDEVINE_CDM_AVAILABLE) 132 #if defined(WIDEVINE_CDM_AVAILABLE)
125 // This function finds "codecs" and parses the value into the vector |codecs|. 133 // This function finds "codecs" and parses the value into the vector |codecs|.
126 // Converts the codec strings to UTF-8 since we only expect ASCII strings and 134 // Converts the codec strings to UTF-8 since we only expect ASCII strings and
127 // this simplifies the rest of the code in this file. 135 // this simplifies the rest of the code in this file.
128 void GetSupportedCodecsForPepperCdm( 136 void GetSupportedCodecsForPepperCdm(
129 const std::vector<base::string16>& additional_param_names, 137 const std::vector<base::string16>& additional_param_names,
130 const std::vector<base::string16>& additional_param_values, 138 const std::vector<base::string16>& additional_param_values,
131 std::vector<std::string>* codecs) { 139 std::vector<std::string>* codecs) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 #if defined(WIDEVINE_CDM_AVAILABLE) 239 #if defined(WIDEVINE_CDM_AVAILABLE)
232 AddPepperBasedWidevine(key_systems_properties); 240 AddPepperBasedWidevine(key_systems_properties);
233 #endif // defined(WIDEVINE_CDM_AVAILABLE) 241 #endif // defined(WIDEVINE_CDM_AVAILABLE)
234 242
235 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 243 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
236 244
237 #if defined(OS_ANDROID) 245 #if defined(OS_ANDROID)
238 cdm::AddAndroidWidevine(key_systems_properties); 246 cdm::AddAndroidWidevine(key_systems_properties);
239 #endif // defined(OS_ANDROID) 247 #endif // defined(OS_ANDROID)
240 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698