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

Side by Side Diff: chrome/common/chrome_content_client.cc

Issue 1637083002: Add CdmService to keep track of CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename + simplification Created 4 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/chrome_content_client.h" 5 #include "chrome/common/chrome_content_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/crash_logging.h" 10 #include "base/debug/crash_logging.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/crash_keys.h" 26 #include "chrome/common/crash_keys.h"
27 #include "chrome/common/pepper_flash.h" 27 #include "chrome/common/pepper_flash.h"
28 #include "chrome/common/secure_origin_whitelist.h" 28 #include "chrome/common/secure_origin_whitelist.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "chrome/grit/common_resources.h" 30 #include "chrome/grit/common_resources.h"
31 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h" 31 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h"
32 #include "components/dom_distiller/core/url_constants.h" 32 #include "components/dom_distiller/core/url_constants.h"
33 #include "components/version_info/version_info.h" 33 #include "components/version_info/version_info.h"
34 #include "content/public/common/cdm_info.h"
34 #include "content/public/common/content_constants.h" 35 #include "content/public/common/content_constants.h"
35 #include "content/public/common/content_switches.h" 36 #include "content/public/common/content_switches.h"
36 #include "content/public/common/url_constants.h" 37 #include "content/public/common/url_constants.h"
37 #include "content/public/common/user_agent.h" 38 #include "content/public/common/user_agent.h"
38 #include "extensions/common/constants.h" 39 #include "extensions/common/constants.h"
39 #include "gpu/config/gpu_info.h" 40 #include "gpu/config/gpu_info.h"
40 #include "net/http/http_util.h" 41 #include "net/http/http_util.h"
41 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/base/layout.h" 43 #include "ui/base/layout.h"
43 #include "ui/base/resource/resource_bundle.h" 44 #include "ui/base/resource/resource_bundle.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface; 92 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface;
92 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module; 93 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module;
93 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module; 94 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module;
94 95
95 #if !defined(DISABLE_NACL) 96 #if !defined(DISABLE_NACL)
96 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface; 97 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface;
97 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; 98 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module;
98 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; 99 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module;
99 #endif 100 #endif
100 101
102 #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
103 static bool IsWidevineAvailable(
ddorwin 2016/03/18 19:24:18 GetWidevine<Something> would be more accurate.
jrummell 2016/03/23 21:38:09 However, the function returns bool to indicate if
104 base::FilePath* cdm_adapter_path,
105 std::vector<base::string16>* codecs_supported,
ddorwin 2016/03/18 19:24:18 Should we really be working in string16 here? I th
jrummell 2016/03/23 21:38:09 Done.
106 std::vector<base::string16>* supported_init_data_types) {
ddorwin 2016/03/18 19:24:17 supported_init_data_types is never used. Even with
jrummell 2016/03/23 21:38:09 Removed.
107 static bool skip_widevine_cdm_file_check = false;
108 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, cdm_adapter_path)) {
ddorwin 2016/03/18 20:38:53 This code will compile on all platforms except Win
ddorwin 2016/03/18 20:48:56 Note that the previous location of this was protec
xhwang 2016/03/18 20:57:58 Note sure if I understand the question completely
ddorwin 2016/03/18 22:22:11 I thought the CDM Registry and related IPCs were g
xhwang 2016/03/18 23:16:02 Agreed that we should unify the two IPC paths. I i
109 if (skip_widevine_cdm_file_check || base::PathExists(*cdm_adapter_path)) {
110 skip_widevine_cdm_file_check = true;
111
112 // Add the supported codecs as if they came from the component manifest.
113 // This list must match the CDM that is being bundled with Chrome.
114 codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecVp8));
115 codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecVp9));
116 #if defined(USE_PROPRIETARY_CODECS)
117 codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecAvc1));
118 #endif // defined(USE_PROPRIETARY_CODECS)
119
120 // TODO(crbug.com/469202). Add support for initDataTypes in the component
121 // manifest, and then duplicate the settings here.
122 return true;
123 }
124 }
125
126 return false;
127 }
128 #endif // defined(WIDEVINE_CDM_AVAILABLE) &&
129 // !defined(WIDEVINE_CDM_IS_COMPONENT)
130
101 // Appends the known built-in plugins to the given vector. Some built-in 131 // Appends the known built-in plugins to the given vector. Some built-in
102 // plugins are "internal" which means they are compiled into the Chrome binary, 132 // plugins are "internal" which means they are compiled into the Chrome binary,
103 // and some are extra shared libraries distributed with the browser (these are 133 // and some are extra shared libraries distributed with the browser (these are
104 // not marked internal, aside from being automatically registered, they're just 134 // not marked internal, aside from being automatically registered, they're just
105 // regular plugins). 135 // regular plugins).
106 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { 136 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
107 #if defined(ENABLE_PDF) 137 #if defined(ENABLE_PDF)
108 content::PepperPluginInfo pdf_info; 138 content::PepperPluginInfo pdf_info;
109 pdf_info.is_internal = true; 139 pdf_info.is_internal = true;
110 pdf_info.is_out_of_process = true; 140 pdf_info.is_out_of_process = true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 nacl.mime_types.push_back(pnacl_mime_type); 177 nacl.mime_types.push_back(pnacl_mime_type);
148 nacl.internal_entry_points.get_interface = g_nacl_get_interface; 178 nacl.internal_entry_points.get_interface = g_nacl_get_interface;
149 nacl.internal_entry_points.initialize_module = g_nacl_initialize_module; 179 nacl.internal_entry_points.initialize_module = g_nacl_initialize_module;
150 nacl.internal_entry_points.shutdown_module = g_nacl_shutdown_module; 180 nacl.internal_entry_points.shutdown_module = g_nacl_shutdown_module;
151 nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV; 181 nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV;
152 plugins->push_back(nacl); 182 plugins->push_back(nacl);
153 } 183 }
154 #endif // !defined(DISABLE_NACL) 184 #endif // !defined(DISABLE_NACL)
155 185
156 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ 186 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
157 !defined(WIDEVINE_CDM_IS_COMPONENT) 187 !defined(WIDEVINE_CDM_IS_COMPONENT)
xhwang 2016/03/18 19:35:38 Why remove skip_widevine_cdm_file_check?
jrummell 2016/03/23 21:38:09 It has simply moved to the IsWidevineAvailable() m
158 static bool skip_widevine_cdm_file_check = false; 188 std::vector<base::string16> codecs_supported;
159 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { 189 std::vector<base::string16> supported_init_data_types;
160 if (skip_widevine_cdm_file_check || base::PathExists(path)) { 190 if (IsWidevineAvailable(&path, &codecs_supported,
161 content::PepperPluginInfo widevine_cdm; 191 &supported_init_data_types)) {
162 widevine_cdm.is_out_of_process = true; 192 content::PepperPluginInfo widevine_cdm;
163 widevine_cdm.path = path; 193 widevine_cdm.is_out_of_process = true;
164 widevine_cdm.name = kWidevineCdmDisplayName; 194 widevine_cdm.path = path;
165 widevine_cdm.description = kWidevineCdmDescription + 195 widevine_cdm.name = kWidevineCdmDisplayName;
166 std::string(" (version: ") + 196 widevine_cdm.description = kWidevineCdmDescription +
167 WIDEVINE_CDM_VERSION_STRING + ")"; 197 std::string(" (version: ") +
168 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; 198 WIDEVINE_CDM_VERSION_STRING + ")";
169 content::WebPluginMimeType widevine_cdm_mime_type( 199 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING;
170 kWidevineCdmPluginMimeType, 200 content::WebPluginMimeType widevine_cdm_mime_type(
171 kWidevineCdmPluginExtension, 201 kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension,
172 kWidevineCdmPluginMimeTypeDescription); 202 kWidevineCdmPluginMimeTypeDescription);
173 203
174 // Add the supported codecs as if they came from the component manifest. 204 widevine_cdm_mime_type.additional_param_names.push_back(
175 // This list must match the CDM that is being bundled with Chrome. 205 base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
176 std::vector<std::string> codecs; 206 widevine_cdm_mime_type.additional_param_values.push_back(base::JoinString(
177 codecs.push_back(kCdmSupportedCodecVp8); 207 codecs_supported,
178 codecs.push_back(kCdmSupportedCodecVp9); 208 base::ASCIIToUTF16(std::string(1, kCdmSupportedCodecsValueDelimiter))));
179 #if defined(USE_PROPRIETARY_CODECS)
180 codecs.push_back(kCdmSupportedCodecAvc1);
181 #endif // defined(USE_PROPRIETARY_CODECS)
182 std::string codec_string = base::JoinString(
183 codecs, std::string(1, kCdmSupportedCodecsValueDelimiter));
184 widevine_cdm_mime_type.additional_param_names.push_back(
185 base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
186 widevine_cdm_mime_type.additional_param_values.push_back(
187 base::ASCIIToUTF16(codec_string));
188 209
189 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); 210 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
190 widevine_cdm.permissions = kWidevineCdmPluginPermissions; 211 widevine_cdm.permissions = kWidevineCdmPluginPermissions;
191 plugins->push_back(widevine_cdm); 212 plugins->push_back(widevine_cdm);
192
193 skip_widevine_cdm_file_check = true;
194 }
195 } 213 }
196 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && 214 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
197 // !defined(WIDEVINE_CDM_IS_COMPONENT) 215 // !defined(WIDEVINE_CDM_IS_COMPONENT)
198 } 216 }
199 217
200 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, 218 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
201 const std::string& version, 219 const std::string& version,
202 bool is_debug) { 220 bool is_debug) {
203 content::PepperPluginInfo plugin; 221 content::PepperPluginInfo plugin;
204 222
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 flash_versions.push_back(system_flash.release()); 531 flash_versions.push_back(system_flash.release());
514 532
515 // This function will return only the most recent version of the flash plugin. 533 // This function will return only the most recent version of the flash plugin.
516 content::PepperPluginInfo* max_flash = 534 content::PepperPluginInfo* max_flash =
517 FindMostRecentPlugin(flash_versions.get()); 535 FindMostRecentPlugin(flash_versions.get());
518 if (max_flash) 536 if (max_flash)
519 plugins->push_back(*max_flash); 537 plugins->push_back(*max_flash);
520 #endif // defined(ENABLE_PLUGINS) 538 #endif // defined(ENABLE_PLUGINS)
521 } 539 }
522 540
541 void ChromeContentClient::AddContentDecryptionModules(
ddorwin 2016/03/18 20:38:53 I think you need to put all this code in a separat
jrummell 2016/03/23 21:38:09 Added RegisterAllAvailableCdms() that will call Ad
542 std::vector<content::CdmInfo>* modules) {
543 #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
544 base::FilePath widevine_adapter_path;
545 std::vector<base::string16> codecs_supported;
546 std::vector<base::string16> supported_init_data_types;
547 if (IsWidevineAvailable(&widevine_adapter_path, &codecs_supported,
548 &supported_init_data_types)) {
549 // |key_systems| needs |path| to be the actual Widevine library,
550 // not the adapter, so adjust as necessary. It will be in the
551 // same directory as the installed adapter.
552 modules->push_back(content::CdmInfo(
553 kWidevineKeySystem, WIDEVINE_CDM_VERSION_STRING,
554 widevine_adapter_path.DirName().AppendASCII(kWidevineCdmFileName),
ddorwin 2016/03/18 19:24:17 This line should be a separate statement under the
jrummell 2016/03/23 21:38:09 Done.
555 codecs_supported, supported_init_data_types));
556 }
557 #endif // defined(WIDEVINE_CDM_AVAILABLE) &&
558 // !defined(WIDEVINE_CDM_IS_COMPONENT)
559 }
ddorwin 2016/03/18 19:24:18 TODO: Add ECK?
jrummell 2016/03/23 21:38:09 Done.
560
523 #if defined(OS_CHROMEOS) 561 #if defined(OS_CHROMEOS)
524 static const int kNumChromeStandardURLSchemes = 6; 562 static const int kNumChromeStandardURLSchemes = 6;
525 #else 563 #else
526 static const int kNumChromeStandardURLSchemes = 5; 564 static const int kNumChromeStandardURLSchemes = 5;
527 #endif 565 #endif
528 static const url::SchemeWithType kChromeStandardURLSchemes[ 566 static const url::SchemeWithType kChromeStandardURLSchemes[
529 kNumChromeStandardURLSchemes] = { 567 kNumChromeStandardURLSchemes] = {
530 {extensions::kExtensionScheme, url::SCHEME_WITHOUT_PORT}, 568 {extensions::kExtensionScheme, url::SCHEME_WITHOUT_PORT},
531 {chrome::kChromeNativeScheme, url::SCHEME_WITHOUT_PORT}, 569 {chrome::kChromeNativeScheme, url::SCHEME_WITHOUT_PORT},
532 {extensions::kExtensionResourceScheme, url::SCHEME_WITHOUT_PORT}, 570 {extensions::kExtensionResourceScheme, url::SCHEME_WITHOUT_PORT},
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 #if defined(ENABLE_EXTENSIONS) 677 #if defined(ENABLE_EXTENSIONS)
640 return extensions::IsIsolateExtensionsEnabled(); 678 return extensions::IsIsolateExtensionsEnabled();
641 #else 679 #else
642 return false; 680 return false;
643 #endif 681 #endif
644 } 682 }
645 683
646 base::StringPiece ChromeContentClient::GetOriginTrialPublicKey() { 684 base::StringPiece ChromeContentClient::GetOriginTrialPublicKey() {
647 return origin_trial_key_manager_.GetPublicKey(); 685 return origin_trial_key_manager_.GetPublicKey();
648 } 686 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698