| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/component_updater/widevine_cdm_component_installer.h" | 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/values.h" | 28 #include "base/values.h" |
| 29 #include "build/build_config.h" | 29 #include "build/build_config.h" |
| 30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/widevine_cdm_constants.h" | 31 #include "chrome/common/widevine_cdm_constants.h" |
| 32 #include "components/component_updater/component_updater_service.h" | 32 #include "components/component_updater/component_updater_service.h" |
| 33 #include "components/component_updater/default_component_installer.h" | 33 #include "components/component_updater/default_component_installer.h" |
| 34 #include "components/version_info/version_info.h" | 34 #include "components/version_info/version_info.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/cdm_service.h" | 36 #include "content/public/browser/cdm_registry.h" |
| 37 #include "content/public/browser/plugin_service.h" | 37 #include "content/public/browser/plugin_service.h" |
| 38 #include "content/public/common/cdm_info.h" | 38 #include "content/public/common/cdm_info.h" |
| 39 #include "content/public/common/pepper_plugin_info.h" | 39 #include "content/public/common/pepper_plugin_info.h" |
| 40 #include "media/cdm/supported_cdm_versions.h" | 40 #include "media/cdm/supported_cdm_versions.h" |
| 41 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 41 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
| 42 | 42 |
| 43 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT | 43 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT |
| 44 | 44 |
| 45 using content::BrowserThread; | 45 using content::BrowserThread; |
| 46 using content::CdmService; | 46 using content::CdmRegistry; |
| 47 using content::PluginService; | 47 using content::PluginService; |
| 48 | 48 |
| 49 namespace component_updater { | 49 namespace component_updater { |
| 50 | 50 |
| 51 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 51 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 // CRX hash. The extension id is: oimompecagnajdejgnnjijobebaeigek. | 55 // CRX hash. The extension id is: oimompecagnajdejgnnjijobebaeigek. |
| 56 const uint8_t kSha2Hash[] = {0xe8, 0xce, 0xcf, 0x42, 0x06, 0xd0, 0x93, 0x49, | 56 const uint8_t kSha2Hash[] = {0xe8, 0xce, 0xcf, 0x42, 0x06, 0xd0, 0x93, 0x49, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 VLOG(1) << "Register Widevine CDM with Chrome"; | 221 VLOG(1) << "Register Widevine CDM with Chrome"; |
| 222 | 222 |
| 223 // true = Add to beginning of list to override any existing registrations. | 223 // true = Add to beginning of list to override any existing registrations. |
| 224 PluginService::GetInstance()->RegisterInternalPlugin( | 224 PluginService::GetInstance()->RegisterInternalPlugin( |
| 225 plugin_info.ToWebPluginInfo(), true); | 225 plugin_info.ToWebPluginInfo(), true); |
| 226 // Tell the browser to refresh the plugin list. Then tell all renderers to | 226 // Tell the browser to refresh the plugin list. Then tell all renderers to |
| 227 // update their plugin list caches. | 227 // update their plugin list caches. |
| 228 PluginService::GetInstance()->RefreshPlugins(); | 228 PluginService::GetInstance()->RefreshPlugins(); |
| 229 PluginService::GetInstance()->PurgePluginListCache(NULL, false); | 229 PluginService::GetInstance()->PurgePluginListCache(NULL, false); |
| 230 | 230 |
| 231 // Also register Widevine with the CdmService. | 231 // Also register Widevine with the CdmRegistry. |
| 232 const base::FilePath cdm_path = | 232 const base::FilePath cdm_path = |
| 233 GetPlatformDirectory(cdm_install_dir) | 233 GetPlatformDirectory(cdm_install_dir) |
| 234 .AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName)); | 234 .AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName)); |
| 235 const std::vector<std::string> supported_codecs = base::SplitString( | 235 const std::vector<std::string> supported_codecs = base::SplitString( |
| 236 codecs, std::string(1, kCdmSupportedCodecsValueDelimiter), | 236 codecs, std::string(1, kCdmSupportedCodecsValueDelimiter), |
| 237 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 237 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 238 CdmService::GetInstance()->RegisterCdm(content::CdmInfo( | 238 CdmRegistry::GetInstance()->RegisterCdm(content::CdmInfo( |
| 239 kWidevineCdmType, cdm_version, cdm_path, supported_codecs)); | 239 kWidevineCdmType, cdm_version, cdm_path, supported_codecs)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace | 242 } // namespace |
| 243 | 243 |
| 244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { | 244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { |
| 245 public: | 245 public: |
| 246 WidevineCdmComponentInstallerTraits(); | 246 WidevineCdmComponentInstallerTraits(); |
| 247 ~WidevineCdmComponentInstallerTraits() override {} | 247 ~WidevineCdmComponentInstallerTraits() override {} |
| 248 | 248 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 std::unique_ptr<ComponentInstallerTraits> traits( | 416 std::unique_ptr<ComponentInstallerTraits> traits( |
| 417 new WidevineCdmComponentInstallerTraits); | 417 new WidevineCdmComponentInstallerTraits); |
| 418 // |cus| will take ownership of |installer| during installer->Register(cus). | 418 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 419 DefaultComponentInstaller* installer = | 419 DefaultComponentInstaller* installer = |
| 420 new DefaultComponentInstaller(std::move(traits)); | 420 new DefaultComponentInstaller(std::move(traits)); |
| 421 installer->Register(cus, base::Closure()); | 421 installer->Register(cus, base::Closure()); |
| 422 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 422 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace component_updater | 425 } // namespace component_updater |
| OLD | NEW |