Move EME key system knowledge from content/ to chrome/.
[chromium-blink-merge.git] / content / renderer / media / crypto / key_systems_info.cc
blob22bc7181b2486973a79f55b47bfad6adaa9be536
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
3 // found in the LICENSE file.
5 #include "content/renderer/media/crypto/key_systems_info.h"
7 #include "third_party/WebKit/public/platform/WebString.h"
9 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
11 // The following must be after widevine_cdm_version.h.
13 #if defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE)
14 #include "base/command_line.h"
15 #include "media/base/media_switches.h"
16 #endif
18 namespace content {
20 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
22 bool IsCanPlayTypeSuppressed(const std::string& key_system) {
23 #if defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE)
24 // See http://crbug.com/237627.
25 if (key_system == kWidevineKeySystem &&
26 !CommandLine::ForCurrentProcess()->HasSwitch(
27 switches::kOverrideEncryptedMediaCanPlayType))
28 return true;
29 #endif
30 return false;
33 std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system) {
34 if (key_system == kClearKeyKeySystem)
35 return "ClearKey";
36 #if defined(WIDEVINE_CDM_AVAILABLE)
37 if (key_system == kWidevineKeySystem)
38 return "Widevine";
39 #endif // WIDEVINE_CDM_AVAILABLE
40 return "Unknown";
43 } // namespace content