Add widevine third party
Add 2 new command options to use widevine: - widevine-cdm-path: Path to widevine plugin - widevine-cdm-version: Version of the widevine plugin
This commit is contained in:
		
					parent
					
						
							
								5f3c6107d5
							
						
					
				
			
			
				commit
				
					
						9d878ad6b2
					
				
			
		
					 17 changed files with 529 additions and 12 deletions
				
			
		
							
								
								
									
										20
									
								
								atom.gyp
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								atom.gyp
									
										
									
									
									
								
							| 
						 | 
					@ -235,6 +235,8 @@
 | 
				
			||||||
        # Defined in Chromium but not exposed in its gyp file.
 | 
					        # Defined in Chromium but not exposed in its gyp file.
 | 
				
			||||||
        'V8_USE_EXTERNAL_STARTUP_DATA',
 | 
					        'V8_USE_EXTERNAL_STARTUP_DATA',
 | 
				
			||||||
        'ENABLE_PLUGINS',
 | 
					        'ENABLE_PLUGINS',
 | 
				
			||||||
 | 
					        'ENABLE_PEPPER_CDMS',
 | 
				
			||||||
 | 
					        'USE_PROPRIETARY_CODECS',
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      'sources': [
 | 
					      'sources': [
 | 
				
			||||||
        '<@(lib_sources)',
 | 
					        '<@(lib_sources)',
 | 
				
			||||||
| 
						 | 
					@ -260,11 +262,18 @@
 | 
				
			||||||
        '<(libchromiumcontent_src_dir)/third_party/libyuv/include',
 | 
					        '<(libchromiumcontent_src_dir)/third_party/libyuv/include',
 | 
				
			||||||
        # The 'third_party/webrtc/modules/desktop_capture/desktop_frame.h' is using 'webrtc/base/scoped_ptr.h'.
 | 
					        # The 'third_party/webrtc/modules/desktop_capture/desktop_frame.h' is using 'webrtc/base/scoped_ptr.h'.
 | 
				
			||||||
        '<(libchromiumcontent_src_dir)/third_party/',
 | 
					        '<(libchromiumcontent_src_dir)/third_party/',
 | 
				
			||||||
 | 
					        '<(libchromiumcontent_src_dir)/components/cdm',
 | 
				
			||||||
 | 
					        '<(libchromiumcontent_src_dir)/third_party/widevine',
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      'direct_dependent_settings': {
 | 
					      'direct_dependent_settings': {
 | 
				
			||||||
        'include_dirs': [
 | 
					        'include_dirs': [
 | 
				
			||||||
          '.',
 | 
					          '.',
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
 | 
					        'ldflags': [
 | 
				
			||||||
 | 
					          '-Wl,--whole-archive',
 | 
				
			||||||
 | 
					          '<@(libchromiumcontent_libraries)',
 | 
				
			||||||
 | 
					          '-Wl,--no-whole-archive',
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      'export_dependent_settings': [
 | 
					      'export_dependent_settings': [
 | 
				
			||||||
        'vendor/brightray/brightray.gyp:brightray',
 | 
					        'vendor/brightray/brightray.gyp:brightray',
 | 
				
			||||||
| 
						 | 
					@ -434,6 +443,7 @@
 | 
				
			||||||
            '<(libchromiumcontent_dir)/icudtl.dat',
 | 
					            '<(libchromiumcontent_dir)/icudtl.dat',
 | 
				
			||||||
            '<(libchromiumcontent_dir)/natives_blob.bin',
 | 
					            '<(libchromiumcontent_dir)/natives_blob.bin',
 | 
				
			||||||
            '<(libchromiumcontent_dir)/snapshot_blob.bin',
 | 
					            '<(libchromiumcontent_dir)/snapshot_blob.bin',
 | 
				
			||||||
 | 
					            '<(libchromiumcontent_dir)/widevinecdmadapter.plugin',
 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
          'xcode_settings': {
 | 
					          'xcode_settings': {
 | 
				
			||||||
            'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name).framework',
 | 
					            'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name).framework',
 | 
				
			||||||
| 
						 | 
					@ -490,6 +500,16 @@
 | 
				
			||||||
                '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Versions/A/<(product_name) Framework',
 | 
					                '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Versions/A/<(product_name) Framework',
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              'postbuild_name': 'Fix path of libwidevinecdm',
 | 
				
			||||||
 | 
					              'action': [
 | 
				
			||||||
 | 
					                'install_name_tool',
 | 
				
			||||||
 | 
					                '-change',
 | 
				
			||||||
 | 
					                '@loader_path/libwidevinecdm.dylib',
 | 
				
			||||||
 | 
					                '@rpath/libwidevinecdm.dylib',
 | 
				
			||||||
 | 
					                '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Versions/A/<(product_name) Framework',
 | 
				
			||||||
 | 
					              ],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              'postbuild_name': 'Add symlinks for framework subdirectories',
 | 
					              'postbuild_name': 'Add symlinks for framework subdirectories',
 | 
				
			||||||
              'action': [
 | 
					              'action': [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,14 +11,24 @@
 | 
				
			||||||
#include "atom/common/chrome_version.h"
 | 
					#include "atom/common/chrome_version.h"
 | 
				
			||||||
#include "atom/common/options_switches.h"
 | 
					#include "atom/common/options_switches.h"
 | 
				
			||||||
#include "base/command_line.h"
 | 
					#include "base/command_line.h"
 | 
				
			||||||
 | 
					#include "base/files/file_util.h"
 | 
				
			||||||
#include "base/strings/string_split.h"
 | 
					#include "base/strings/string_split.h"
 | 
				
			||||||
#include "base/strings/string_util.h"
 | 
					#include "base/strings/string_util.h"
 | 
				
			||||||
 | 
					#include "base/strings/utf_string_conversions.h"
 | 
				
			||||||
#include "content/public/common/content_constants.h"
 | 
					#include "content/public/common/content_constants.h"
 | 
				
			||||||
#include "content/public/common/pepper_plugin_info.h"
 | 
					#include "content/public/common/pepper_plugin_info.h"
 | 
				
			||||||
#include "content/public/common/user_agent.h"
 | 
					#include "content/public/common/user_agent.h"
 | 
				
			||||||
#include "ppapi/shared_impl/ppapi_permissions.h"
 | 
					#include "ppapi/shared_impl/ppapi_permissions.h"
 | 
				
			||||||
#include "url/url_constants.h"
 | 
					#include "url/url_constants.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "third_party/widevine/cdm/stub/widevine_cdm_version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// The following must be after widevine_cdm_version.h.
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					// && !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_constants.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace atom {
 | 
					namespace atom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
| 
						 | 
					@ -63,6 +73,52 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
 | 
				
			||||||
  return plugin;
 | 
					  return plugin;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					//&& !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					content::PepperPluginInfo CreateWidevineCdmInfo(const base::FilePath& path,
 | 
				
			||||||
 | 
					                                                const std::string& version) {
 | 
				
			||||||
 | 
					  content::PepperPluginInfo widevine_cdm;
 | 
				
			||||||
 | 
					  widevine_cdm.is_out_of_process = true;
 | 
				
			||||||
 | 
					  widevine_cdm.path = path;
 | 
				
			||||||
 | 
					  widevine_cdm.name = kWidevineCdmDisplayName;
 | 
				
			||||||
 | 
					  widevine_cdm.description = kWidevineCdmDescription +
 | 
				
			||||||
 | 
					                             std::string(" (version: ") +
 | 
				
			||||||
 | 
					                             version + ")";
 | 
				
			||||||
 | 
					  widevine_cdm.version = version;
 | 
				
			||||||
 | 
					  content::WebPluginMimeType widevine_cdm_mime_type(
 | 
				
			||||||
 | 
					      kWidevineCdmPluginMimeType,
 | 
				
			||||||
 | 
					      kWidevineCdmPluginExtension,
 | 
				
			||||||
 | 
					      kWidevineCdmPluginMimeTypeDescription);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Add the supported codecs as if they came from the component manifest.
 | 
				
			||||||
 | 
					  std::vector<std::string> codecs;
 | 
				
			||||||
 | 
					  codecs.push_back(kCdmSupportedCodecVorbis);
 | 
				
			||||||
 | 
					  codecs.push_back(kCdmSupportedCodecVp8);
 | 
				
			||||||
 | 
					  codecs.push_back(kCdmSupportedCodecVp9);
 | 
				
			||||||
 | 
					#if defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					  codecs.push_back(kCdmSupportedCodecAac);
 | 
				
			||||||
 | 
					  codecs.push_back(kCdmSupportedCodecAvc1);
 | 
				
			||||||
 | 
					#endif  // defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					  std::string codec_string = base::JoinString(
 | 
				
			||||||
 | 
					      codecs, std::string(1, kCdmSupportedCodecsValueDelimiter));
 | 
				
			||||||
 | 
					  widevine_cdm_mime_type.additional_param_names.push_back(
 | 
				
			||||||
 | 
					      base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
 | 
				
			||||||
 | 
					  widevine_cdm_mime_type.additional_param_values.push_back(
 | 
				
			||||||
 | 
					      base::ASCIIToUTF16(codec_string));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
 | 
				
			||||||
 | 
					  widevine_cdm.permissions = kWidevineCdmPluginPermissions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return widevine_cdm;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					// defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
 | 
				
			||||||
 | 
					// !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
 | 
					void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
 | 
				
			||||||
                                        const char* separator,
 | 
					                                        const char* separator,
 | 
				
			||||||
                                        const char* cmd_switch) {
 | 
					                                        const char* cmd_switch) {
 | 
				
			||||||
| 
						 | 
					@ -76,6 +132,49 @@ void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AddPepperFlashFromCommandLine(
 | 
				
			||||||
 | 
					    std::vector<content::PepperPluginInfo>* plugins) {
 | 
				
			||||||
 | 
					  auto command_line = base::CommandLine::ForCurrentProcess();
 | 
				
			||||||
 | 
					  auto flash_path = command_line->GetSwitchValueNative(
 | 
				
			||||||
 | 
					      switches::kPpapiFlashPath);
 | 
				
			||||||
 | 
					  if (flash_path.empty())
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  auto flash_version = command_line->GetSwitchValueASCII(
 | 
				
			||||||
 | 
					      switches::kPpapiFlashVersion);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  plugins->push_back(
 | 
				
			||||||
 | 
					      CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					//&& !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					void AddWidevineCdmFromCommandLine(
 | 
				
			||||||
 | 
					    std::vector<content::PepperPluginInfo>* plugins) {
 | 
				
			||||||
 | 
					  auto command_line = base::CommandLine::ForCurrentProcess();
 | 
				
			||||||
 | 
					  auto widevine_cdm_path = command_line->GetSwitchValueNative(
 | 
				
			||||||
 | 
					    switches::kWidevineCdmPath);
 | 
				
			||||||
 | 
					  if (widevine_cdm_path.empty())
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!base::PathExists(base::FilePath(widevine_cdm_path)))
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  auto widevine_cdm_version = command_line->GetSwitchValueASCII(
 | 
				
			||||||
 | 
					    switches::kWidevineCdmVersion);
 | 
				
			||||||
 | 
					  if (widevine_cdm_version.empty())
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  plugins->push_back(
 | 
				
			||||||
 | 
					      CreateWidevineCdmInfo(base::FilePath(widevine_cdm_path),
 | 
				
			||||||
 | 
					                            widevine_cdm_version));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					// defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
 | 
				
			||||||
 | 
					// !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AtomContentClient::AtomContentClient() {
 | 
					AtomContentClient::AtomContentClient() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,17 +206,12 @@ void AtomContentClient::AddAdditionalSchemes(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AtomContentClient::AddPepperPlugins(
 | 
					void AtomContentClient::AddPepperPlugins(
 | 
				
			||||||
    std::vector<content::PepperPluginInfo>* plugins) {
 | 
					    std::vector<content::PepperPluginInfo>* plugins) {
 | 
				
			||||||
  auto command_line = base::CommandLine::ForCurrentProcess();
 | 
					  AddPepperFlashFromCommandLine(plugins);
 | 
				
			||||||
  auto flash_path = command_line->GetSwitchValuePath(
 | 
					 | 
				
			||||||
      switches::kPpapiFlashPath);
 | 
					 | 
				
			||||||
  if (flash_path.empty())
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto flash_version = command_line->GetSwitchValueASCII(
 | 
					  #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
      switches::kPpapiFlashVersion);
 | 
					  //&& !defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
 | 
					  AddWidevineCdmFromCommandLine(plugins);
 | 
				
			||||||
  plugins->push_back(
 | 
					  #endif
 | 
				
			||||||
      CreatePepperFlashInfo(flash_path, flash_version));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AtomContentClient::AddServiceWorkerSchemes(
 | 
					void AtomContentClient::AddServiceWorkerSchemes(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@
 | 
				
			||||||
#include "base/strings/string_number_conversions.h"
 | 
					#include "base/strings/string_number_conversions.h"
 | 
				
			||||||
#include "chrome/browser/printing/printing_message_filter.h"
 | 
					#include "chrome/browser/printing/printing_message_filter.h"
 | 
				
			||||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
 | 
					#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
 | 
				
			||||||
 | 
					#include "chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h"
 | 
				
			||||||
#include "chrome/browser/speech/tts_message_filter.h"
 | 
					#include "chrome/browser/speech/tts_message_filter.h"
 | 
				
			||||||
#include "content/public/browser/browser_ppapi_host.h"
 | 
					#include "content/public/browser/browser_ppapi_host.h"
 | 
				
			||||||
#include "content/public/browser/client_certificate_delegate.h"
 | 
					#include "content/public/browser/client_certificate_delegate.h"
 | 
				
			||||||
| 
						 | 
					@ -105,6 +106,8 @@ void AtomBrowserClient::RenderProcessWillLaunch(
 | 
				
			||||||
  int process_id = host->GetID();
 | 
					  int process_id = host->GetID();
 | 
				
			||||||
  host->AddFilter(new printing::PrintingMessageFilter(process_id));
 | 
					  host->AddFilter(new printing::PrintingMessageFilter(process_id));
 | 
				
			||||||
  host->AddFilter(new TtsMessageFilter(process_id, host->GetBrowserContext()));
 | 
					  host->AddFilter(new TtsMessageFilter(process_id, host->GetBrowserContext()));
 | 
				
			||||||
 | 
					  host->AddFilter(
 | 
				
			||||||
 | 
					    new WidevineCdmMessageFilter(process_id, host->GetBrowserContext()));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
content::SpeechRecognitionManagerDelegate*
 | 
					content::SpeechRecognitionManagerDelegate*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,3 +7,4 @@
 | 
				
			||||||
#include "atom/common/api/api_messages.h"
 | 
					#include "atom/common/api/api_messages.h"
 | 
				
			||||||
#include "chrome/common/print_messages.h"
 | 
					#include "chrome/common/print_messages.h"
 | 
				
			||||||
#include "chrome/common/tts_messages.h"
 | 
					#include "chrome/common/tts_messages.h"
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_messages.h"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,6 +148,12 @@ const char kSharedWorker[]               = "shared-worker";
 | 
				
			||||||
const char kPageVisibility[]             = "page-visiblity";
 | 
					const char kPageVisibility[]             = "page-visiblity";
 | 
				
			||||||
const char kOpenerID[]                   = "opener-id";
 | 
					const char kOpenerID[]                   = "opener-id";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Widevine options
 | 
				
			||||||
 | 
					// Path to Widevine CDM binaries.
 | 
				
			||||||
 | 
					const char kWidevineCdmPath[] = "widevine-cdm-path";
 | 
				
			||||||
 | 
					// Widevine CDM version.
 | 
				
			||||||
 | 
					const char kWidevineCdmVersion[] = "widevine-cdm-version";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace switches
 | 
					}  // namespace switches
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace atom
 | 
					}  // namespace atom
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,6 +84,9 @@ extern const char kSharedWorker[];
 | 
				
			||||||
extern const char kPageVisibility[];
 | 
					extern const char kPageVisibility[];
 | 
				
			||||||
extern const char kOpenerID[];
 | 
					extern const char kOpenerID[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern const char kWidevineCdmPath[];
 | 
				
			||||||
 | 
					extern const char kWidevineCdmVersion[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace switches
 | 
					}  // namespace switches
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace atom
 | 
					}  // namespace atom
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
#include "atom/renderer/atom_renderer_client.h"
 | 
					#include "atom/renderer/atom_renderer_client.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "atom/common/api/api_messages.h"
 | 
					#include "atom/common/api/api_messages.h"
 | 
				
			||||||
#include "atom/common/api/atom_bindings.h"
 | 
					#include "atom/common/api/atom_bindings.h"
 | 
				
			||||||
| 
						 | 
					@ -15,6 +16,7 @@
 | 
				
			||||||
#include "atom/renderer/guest_view_container.h"
 | 
					#include "atom/renderer/guest_view_container.h"
 | 
				
			||||||
#include "atom/renderer/node_array_buffer_bridge.h"
 | 
					#include "atom/renderer/node_array_buffer_bridge.h"
 | 
				
			||||||
#include "base/command_line.h"
 | 
					#include "base/command_line.h"
 | 
				
			||||||
 | 
					#include "chrome/renderer/media/chrome_key_systems.h"
 | 
				
			||||||
#include "chrome/renderer/pepper/pepper_helper.h"
 | 
					#include "chrome/renderer/pepper/pepper_helper.h"
 | 
				
			||||||
#include "chrome/renderer/printing/print_web_view_helper.h"
 | 
					#include "chrome/renderer/printing/print_web_view_helper.h"
 | 
				
			||||||
#include "chrome/renderer/tts_dispatcher.h"
 | 
					#include "chrome/renderer/tts_dispatcher.h"
 | 
				
			||||||
| 
						 | 
					@ -234,4 +236,9 @@ void AtomRendererClient::EnableWebRuntimeFeatures() {
 | 
				
			||||||
    blink::WebRuntimeFeatures::enableSharedWorker(true);
 | 
					    blink::WebRuntimeFeatures::enableSharedWorker(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AtomRendererClient::AddKeySystems(
 | 
				
			||||||
 | 
					  std::vector<media::KeySystemInfo>* key_systems) {
 | 
				
			||||||
 | 
					  AddChromeKeySystems(key_systems);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace atom
 | 
					}  // namespace atom
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
#define ATOM_RENDERER_ATOM_RENDERER_CLIENT_H_
 | 
					#define ATOM_RENDERER_ATOM_RENDERER_CLIENT_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "content/public/renderer/content_renderer_client.h"
 | 
					#include "content/public/renderer/content_renderer_client.h"
 | 
				
			||||||
#include "content/public/renderer/render_process_observer.h"
 | 
					#include "content/public/renderer/render_process_observer.h"
 | 
				
			||||||
| 
						 | 
					@ -58,7 +59,7 @@ class AtomRendererClient : public content::ContentRendererClient,
 | 
				
			||||||
  bool ShouldOverridePageVisibilityState(
 | 
					  bool ShouldOverridePageVisibilityState(
 | 
				
			||||||
      const content::RenderFrame* render_frame,
 | 
					      const content::RenderFrame* render_frame,
 | 
				
			||||||
      blink::WebPageVisibilityState* override_state) override;
 | 
					      blink::WebPageVisibilityState* override_state) override;
 | 
				
			||||||
 | 
					  void AddKeySystems(std::vector<media::KeySystemInfo>* key_systems) override;
 | 
				
			||||||
  void EnableWebRuntimeFeatures();
 | 
					  void EnableWebRuntimeFeatures();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  scoped_ptr<NodeBindings> node_bindings_;
 | 
					  scoped_ptr<NodeBindings> node_bindings_;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,70 @@
 | 
				
			||||||
 | 
					// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "base/bind.h"
 | 
				
			||||||
 | 
					#include "content/public/browser/browser_context.h"
 | 
				
			||||||
 | 
					#include "content/public/browser/render_process_host.h"
 | 
				
			||||||
 | 
					#include "content/public/common/webplugininfo.h"
 | 
				
			||||||
 | 
					#include "content/public/browser/plugin_service.h"
 | 
				
			||||||
 | 
					using content::PluginService;
 | 
				
			||||||
 | 
					using content::WebPluginInfo;
 | 
				
			||||||
 | 
					using content::BrowserThread;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WidevineCdmMessageFilter::WidevineCdmMessageFilter(
 | 
				
			||||||
 | 
					    int render_process_id,
 | 
				
			||||||
 | 
					    content::BrowserContext* browser_context)
 | 
				
			||||||
 | 
					    : BrowserMessageFilter(ChromeMsgStart),
 | 
				
			||||||
 | 
					      render_process_id_(render_process_id),
 | 
				
			||||||
 | 
					      browser_context_(browser_context) {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool WidevineCdmMessageFilter::OnMessageReceived(const IPC::Message& message) {
 | 
				
			||||||
 | 
					  IPC_BEGIN_MESSAGE_MAP(WidevineCdmMessageFilter, message)
 | 
				
			||||||
 | 
					#if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					    IPC_MESSAGE_HANDLER(
 | 
				
			||||||
 | 
					        ChromeViewHostMsg_IsInternalPluginAvailableForMimeType,
 | 
				
			||||||
 | 
					        OnIsInternalPluginAvailableForMimeType)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    IPC_MESSAGE_UNHANDLED(return false)
 | 
				
			||||||
 | 
					  IPC_END_MESSAGE_MAP()
 | 
				
			||||||
 | 
					  return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					void WidevineCdmMessageFilter::OnIsInternalPluginAvailableForMimeType(
 | 
				
			||||||
 | 
					    const std::string& mime_type,
 | 
				
			||||||
 | 
					    bool* is_available,
 | 
				
			||||||
 | 
					    std::vector<base::string16>* additional_param_names,
 | 
				
			||||||
 | 
					    std::vector<base::string16>* additional_param_values) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  std::vector<WebPluginInfo> plugins;
 | 
				
			||||||
 | 
					  PluginService::GetInstance()->GetInternalPlugins(&plugins);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (size_t i = 0; i < plugins.size(); ++i) {
 | 
				
			||||||
 | 
					    const WebPluginInfo& plugin = plugins[i];
 | 
				
			||||||
 | 
					    const std::vector<content::WebPluginMimeType>& mime_types =
 | 
				
			||||||
 | 
					        plugin.mime_types;
 | 
				
			||||||
 | 
					    for (size_t j = 0; j < mime_types.size(); ++j) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (mime_types[j].mime_type == mime_type) {
 | 
				
			||||||
 | 
					        *is_available = true;
 | 
				
			||||||
 | 
					        *additional_param_names = mime_types[j].additional_param_names;
 | 
				
			||||||
 | 
					        *additional_param_values = mime_types[j].additional_param_values;
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *is_available = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif // defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WidevineCdmMessageFilter::OnDestruct() const {
 | 
				
			||||||
 | 
					  BrowserThread::DeleteOnUIThread::Destruct(this);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WidevineCdmMessageFilter::~WidevineCdmMessageFilter() {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,49 @@
 | 
				
			||||||
 | 
					// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
 | 
				
			||||||
 | 
					#define CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_messages.h"
 | 
				
			||||||
 | 
					#include "content/public/browser/browser_message_filter.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace content {
 | 
				
			||||||
 | 
					class BrowserContext;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WidevineCdmMessageFilter : public content::BrowserMessageFilter {
 | 
				
			||||||
 | 
					 public:
 | 
				
			||||||
 | 
					  explicit WidevineCdmMessageFilter(int render_process_id,
 | 
				
			||||||
 | 
					      content::BrowserContext* browser_context);
 | 
				
			||||||
 | 
					  bool OnMessageReceived(const IPC::Message& message) override;
 | 
				
			||||||
 | 
					  void OnDestruct() const override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 private:
 | 
				
			||||||
 | 
					  friend class content::BrowserThread;
 | 
				
			||||||
 | 
					  friend class base::DeleteHelper<WidevineCdmMessageFilter>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  virtual ~WidevineCdmMessageFilter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					  // Returns whether any internal plugin supporting |mime_type| is registered
 | 
				
			||||||
 | 
					  // and enabled. Does not determine whether the plugin can actually be
 | 
				
			||||||
 | 
					  // instantiated (e.g. whether it has all its dependencies).
 | 
				
			||||||
 | 
					  // When the returned *|is_available| is true, |additional_param_names| and
 | 
				
			||||||
 | 
					  // |additional_param_values| contain the name-value pairs, if any, specified
 | 
				
			||||||
 | 
					  // for the *first* non-disabled plugin found that is registered for
 | 
				
			||||||
 | 
					  // |mime_type|.
 | 
				
			||||||
 | 
					  void OnIsInternalPluginAvailableForMimeType(
 | 
				
			||||||
 | 
					      const std::string& mime_type,
 | 
				
			||||||
 | 
					      bool* is_available,
 | 
				
			||||||
 | 
					      std::vector<base::string16>* additional_param_names,
 | 
				
			||||||
 | 
					      std::vector<base::string16>* additional_param_values);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  int render_process_id_;
 | 
				
			||||||
 | 
					  content::BrowserContext* browser_context_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DISALLOW_COPY_AND_ASSIGN(WidevineCdmMessageFilter);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@
 | 
				
			||||||
#include "base/version.h"
 | 
					#include "base/version.h"
 | 
				
			||||||
#include "chrome/common/chrome_constants.h"
 | 
					#include "chrome/common/chrome_constants.h"
 | 
				
			||||||
#include "chrome/common/chrome_paths_internal.h"
 | 
					#include "chrome/common/chrome_paths_internal.h"
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_constants.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(OS_ANDROID)
 | 
					#if defined(OS_ANDROID)
 | 
				
			||||||
#include "base/android/path_utils.h"
 | 
					#include "base/android/path_utils.h"
 | 
				
			||||||
| 
						 | 
					@ -31,6 +32,8 @@
 | 
				
			||||||
#include "base/win/registry.h"
 | 
					#include "base/win/registry.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "third_party/widevine/cdm/stub/widevine_cdm_version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The Pepper Flash plugins are in a directory with this name.
 | 
					// The Pepper Flash plugins are in a directory with this name.
 | 
				
			||||||
| 
						 | 
					@ -362,7 +365,7 @@ bool PathProvider(int key, base::FilePath* result) {
 | 
				
			||||||
    case chrome::DIR_COMPONENT_WIDEVINE_CDM:
 | 
					    case chrome::DIR_COMPONENT_WIDEVINE_CDM:
 | 
				
			||||||
      if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
 | 
					      if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
      cur = cur.Append(FILE_PATH_LITERAL("WidevineCDM"));
 | 
					      cur = cur.Append(kWidevineCdmBaseDirectory);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
#endif  // defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
					#endif  // defined(WIDEVINE_CDM_IS_COMPONENT)
 | 
				
			||||||
    // TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.
 | 
					    // TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								chromium_src/chrome/common/widevine_cdm_constants.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								chromium_src/chrome/common/widevine_cdm_constants.cc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_constants.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "build/build_config.h"
 | 
				
			||||||
 | 
					#include "ppapi/shared_impl/ppapi_permissions.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const base::FilePath::CharType kWidevineCdmBaseDirectory[] =
 | 
				
			||||||
 | 
					    FILE_PATH_LITERAL("WidevineCDM");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char kWidevineCdmPluginExtension[] = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const int32 kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV |
 | 
				
			||||||
 | 
					                                            ppapi::PERMISSION_PRIVATE;
 | 
				
			||||||
							
								
								
									
										19
									
								
								chromium_src/chrome/common/widevine_cdm_constants.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								chromium_src/chrome/common/widevine_cdm_constants.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_
 | 
				
			||||||
 | 
					#define CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "base/basictypes.h"
 | 
				
			||||||
 | 
					#include "base/files/file_path.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// The Widevine CDM adapter and Widevine CDM are in this directory.
 | 
				
			||||||
 | 
					extern const base::FilePath::CharType kWidevineCdmBaseDirectory[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern const char kWidevineCdmPluginExtension[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Permission bits for Widevine CDM plugin.
 | 
				
			||||||
 | 
					extern const int32 kWidevineCdmPluginPermissions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_
 | 
				
			||||||
							
								
								
									
										31
									
								
								chromium_src/chrome/common/widevine_cdm_messages.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								chromium_src/chrome/common/widevine_cdm_messages.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,31 @@
 | 
				
			||||||
 | 
					// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Multiply-included message file, hence no include guard.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ipc/ipc_message_macros.h"
 | 
				
			||||||
 | 
					// #include "ipc/ipc_param_traits.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define IPC_MESSAGE_START ChromeMsgStart
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Renderer -> Browser messages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					// Returns whether any internal plugin supporting |mime_type| is registered and
 | 
				
			||||||
 | 
					// enabled. Does not determine whether the plugin can actually be instantiated
 | 
				
			||||||
 | 
					// (e.g. whether it has all its dependencies).
 | 
				
			||||||
 | 
					// When the returned *|is_available| is true, |additional_param_names| and
 | 
				
			||||||
 | 
					// |additional_param_values| contain the name-value pairs, if any, specified
 | 
				
			||||||
 | 
					// for the *first* non-disabled plugin found that is registered for |mime_type|.
 | 
				
			||||||
 | 
					IPC_SYNC_MESSAGE_CONTROL1_3(
 | 
				
			||||||
 | 
					    ChromeViewHostMsg_IsInternalPluginAvailableForMimeType,
 | 
				
			||||||
 | 
					    std::string /* mime_type */,
 | 
				
			||||||
 | 
					    bool /* is_available */,
 | 
				
			||||||
 | 
					    std::vector<base::string16> /* additional_param_names */,
 | 
				
			||||||
 | 
					    std::vector<base::string16> /* additional_param_values */)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Browser -> Renderer messages.
 | 
				
			||||||
							
								
								
									
										173
									
								
								chromium_src/chrome/renderer/media/chrome_key_systems.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										173
									
								
								chromium_src/chrome/renderer/media/chrome_key_systems.cc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,173 @@
 | 
				
			||||||
 | 
					// Copyright 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "chrome/renderer/media/chrome_key_systems.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "base/logging.h"
 | 
				
			||||||
 | 
					#include "base/strings/string16.h"
 | 
				
			||||||
 | 
					#include "base/strings/string_split.h"
 | 
				
			||||||
 | 
					#include "base/strings/utf_string_conversions.h"
 | 
				
			||||||
 | 
					#include "chrome/common/widevine_cdm_messages.h"
 | 
				
			||||||
 | 
					#include "components/cdm/renderer/widevine_key_systems.h"
 | 
				
			||||||
 | 
					#include "content/public/renderer/render_thread.h"
 | 
				
			||||||
 | 
					#include "media/base/eme_constants.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(OS_ANDROID)
 | 
				
			||||||
 | 
					#include "components/cdm/renderer/android_key_systems.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
 | 
				
			||||||
 | 
					#include "third_party/widevine/cdm/stub/widevine_cdm_version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// The following must be after widevine_cdm_version.h.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
 | 
				
			||||||
 | 
					#include <gnu/libc-version.h>
 | 
				
			||||||
 | 
					#include "base/version.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using media::KeySystemInfo;
 | 
				
			||||||
 | 
					using media::SupportedCodecs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					static bool IsPepperCdmAvailable(
 | 
				
			||||||
 | 
					    const std::string& pepper_type,
 | 
				
			||||||
 | 
					    std::vector<base::string16>* additional_param_names,
 | 
				
			||||||
 | 
					    std::vector<base::string16>* additional_param_values) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bool is_available = false;
 | 
				
			||||||
 | 
					  content::RenderThread::Get()->Send(
 | 
				
			||||||
 | 
					      new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType(
 | 
				
			||||||
 | 
					          pepper_type,
 | 
				
			||||||
 | 
					          &is_available,
 | 
				
			||||||
 | 
					          additional_param_names,
 | 
				
			||||||
 | 
					          additional_param_values));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return is_available;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE)
 | 
				
			||||||
 | 
					// This function finds "codecs" and parses the value into the vector |codecs|.
 | 
				
			||||||
 | 
					// Converts the codec strings to UTF-8 since we only expect ASCII strings and
 | 
				
			||||||
 | 
					// this simplifies the rest of the code in this file.
 | 
				
			||||||
 | 
					void GetSupportedCodecsForPepperCdm(
 | 
				
			||||||
 | 
					    const std::vector<base::string16>& additional_param_names,
 | 
				
			||||||
 | 
					    const std::vector<base::string16>& additional_param_values,
 | 
				
			||||||
 | 
					    std::vector<std::string>* codecs) {
 | 
				
			||||||
 | 
					  DCHECK(codecs->empty());
 | 
				
			||||||
 | 
					  DCHECK_EQ(additional_param_names.size(), additional_param_values.size());
 | 
				
			||||||
 | 
					  for (size_t i = 0; i < additional_param_names.size(); ++i) {
 | 
				
			||||||
 | 
					    if (additional_param_names[i] ==
 | 
				
			||||||
 | 
					        base::ASCIIToUTF16(kCdmSupportedCodecsParamName)) {
 | 
				
			||||||
 | 
					      const base::string16& codecs_string16 = additional_param_values[i];
 | 
				
			||||||
 | 
					      std::string codecs_string;
 | 
				
			||||||
 | 
					      if (!base::UTF16ToUTF8(codecs_string16.c_str(),
 | 
				
			||||||
 | 
					                             codecs_string16.length(),
 | 
				
			||||||
 | 
					                             &codecs_string)) {
 | 
				
			||||||
 | 
					        DLOG(WARNING) << "Non-UTF-8 codecs string.";
 | 
				
			||||||
 | 
					        // Continue using the best effort conversion.
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      *codecs = base::SplitString(
 | 
				
			||||||
 | 
					          codecs_string, std::string(1, kCdmSupportedCodecsValueDelimiter),
 | 
				
			||||||
 | 
					          base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void AddPepperBasedWidevine(
 | 
				
			||||||
 | 
					    std::vector<KeySystemInfo>* concrete_key_systems) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Version glibc_version(gnu_get_libc_version());
 | 
				
			||||||
 | 
					  DCHECK(glibc_version.IsValid());
 | 
				
			||||||
 | 
					  if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION))
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					#endif  // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  std::vector<base::string16> additional_param_names;
 | 
				
			||||||
 | 
					  std::vector<base::string16> additional_param_values;
 | 
				
			||||||
 | 
					  if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType,
 | 
				
			||||||
 | 
					                            &additional_param_names,
 | 
				
			||||||
 | 
					                            &additional_param_values)) {
 | 
				
			||||||
 | 
					    // DVLOG(1) << "Widevine CDM is not currently available.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  std::vector<std::string> codecs;
 | 
				
			||||||
 | 
					  GetSupportedCodecsForPepperCdm(additional_param_names,
 | 
				
			||||||
 | 
					                                 additional_param_values,
 | 
				
			||||||
 | 
					                                 &codecs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Audio codecs are always supported.
 | 
				
			||||||
 | 
					  // TODO(sandersd): Distinguish these from those that are directly supported,
 | 
				
			||||||
 | 
					  // as those may offer a higher level of protection.
 | 
				
			||||||
 | 
					  supported_codecs |= media::EME_CODEC_WEBM_OPUS;
 | 
				
			||||||
 | 
					  supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					  supported_codecs |= media::EME_CODEC_MP4_AAC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (size_t i = 0; i < codecs.size(); ++i) {
 | 
				
			||||||
 | 
					    if (codecs[i] == kCdmSupportedCodecVp8)
 | 
				
			||||||
 | 
					      supported_codecs |= media::EME_CODEC_WEBM_VP8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (codecs[i] == kCdmSupportedCodecVp9)
 | 
				
			||||||
 | 
					      supported_codecs |= media::EME_CODEC_WEBM_VP9;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					    if (codecs[i] == kCdmSupportedCodecAvc1)
 | 
				
			||||||
 | 
					      supported_codecs |= media::EME_CODEC_MP4_AVC1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // defined(USE_PROPRIETARY_CODECS)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  cdm::AddWidevineWithCodecs(
 | 
				
			||||||
 | 
					      cdm::WIDEVINE, supported_codecs,
 | 
				
			||||||
 | 
					#if defined(OS_CHROMEOS)
 | 
				
			||||||
 | 
					      media::EmeRobustness::HW_SECURE_ALL,  // Maximum audio robustness.
 | 
				
			||||||
 | 
					      media::EmeRobustness::HW_SECURE_ALL,  // Maximim video robustness.
 | 
				
			||||||
 | 
					      media::EmeSessionTypeSupport::
 | 
				
			||||||
 | 
					          SUPPORTED_WITH_IDENTIFIER,  // Persistent-license.
 | 
				
			||||||
 | 
					      media::EmeSessionTypeSupport::
 | 
				
			||||||
 | 
					          NOT_SUPPORTED,                      // Persistent-release-message.
 | 
				
			||||||
 | 
					      media::EmeFeatureSupport::REQUESTABLE,  // Persistent state.
 | 
				
			||||||
 | 
					      media::EmeFeatureSupport::REQUESTABLE,  // Distinctive identifier.
 | 
				
			||||||
 | 
					#else   // (Desktop)
 | 
				
			||||||
 | 
					      media::EmeRobustness::SW_SECURE_CRYPTO,       // Maximum audio robustness.
 | 
				
			||||||
 | 
					      media::EmeRobustness::SW_SECURE_DECODE,       // Maximum video robustness.
 | 
				
			||||||
 | 
					      media::EmeSessionTypeSupport::NOT_SUPPORTED,  // persistent-license.
 | 
				
			||||||
 | 
					      media::EmeSessionTypeSupport::
 | 
				
			||||||
 | 
					          NOT_SUPPORTED,                        // persistent-release-message.
 | 
				
			||||||
 | 
					      media::EmeFeatureSupport::REQUESTABLE,    // Persistent state.
 | 
				
			||||||
 | 
					      media::EmeFeatureSupport::NOT_SUPPORTED,  // Distinctive identifier.
 | 
				
			||||||
 | 
					#endif  // defined(OS_CHROMEOS)
 | 
				
			||||||
 | 
					      concrete_key_systems);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif  // defined(WIDEVINE_CDM_AVAILABLE)
 | 
				
			||||||
 | 
					#endif  // defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					#if defined(WIDEVINE_CDM_AVAILABLE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  AddPepperBasedWidevine(key_systems_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // defined(WIDEVINE_CDM_AVAILABLE)
 | 
				
			||||||
 | 
					#endif  // defined(ENABLE_PEPPER_CDMS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(OS_ANDROID)
 | 
				
			||||||
 | 
					  cdm::AddAndroidWidevine(key_systems_info);
 | 
				
			||||||
 | 
					#endif  // defined(OS_ANDROID)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								chromium_src/chrome/renderer/media/chrome_key_systems.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								chromium_src/chrome/renderer/media/chrome_key_systems.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					// Copyright 2013 The Chromium Authors. All rights reserved.
 | 
				
			||||||
 | 
					// Use of this source code is governed by a BSD-style license that can be
 | 
				
			||||||
 | 
					// found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_
 | 
				
			||||||
 | 
					#define CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "media/base/key_system_info.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AddChromeKeySystems(std::vector<media::KeySystemInfo>* key_systems_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_
 | 
				
			||||||
| 
						 | 
					@ -418,6 +418,8 @@
 | 
				
			||||||
      'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h',
 | 
					      'chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h',
 | 
				
			||||||
      'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc',
 | 
					      'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc',
 | 
				
			||||||
      'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h',
 | 
					      'chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.cc',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h',
 | 
				
			||||||
      'chromium_src/chrome/browser/speech/tts_controller.h',
 | 
					      'chromium_src/chrome/browser/speech/tts_controller.h',
 | 
				
			||||||
      'chromium_src/chrome/browser/speech/tts_controller_impl.cc',
 | 
					      'chromium_src/chrome/browser/speech/tts_controller_impl.cc',
 | 
				
			||||||
      'chromium_src/chrome/browser/speech/tts_controller_impl.h',
 | 
					      'chromium_src/chrome/browser/speech/tts_controller_impl.h',
 | 
				
			||||||
| 
						 | 
					@ -450,6 +452,11 @@
 | 
				
			||||||
      'chromium_src/chrome/common/tts_messages.h',
 | 
					      'chromium_src/chrome/common/tts_messages.h',
 | 
				
			||||||
      'chromium_src/chrome/common/tts_utterance_request.cc',
 | 
					      'chromium_src/chrome/common/tts_utterance_request.cc',
 | 
				
			||||||
      'chromium_src/chrome/common/tts_utterance_request.h',
 | 
					      'chromium_src/chrome/common/tts_utterance_request.h',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/common/widevine_cdm_messages.h',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/common/widevine_cdm_constants.cc',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/common/widevine_cdm_constants.h',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/renderer/media/chrome_key_systems.cc',
 | 
				
			||||||
 | 
					      'chromium_src/chrome/renderer/media/chrome_key_systems.h',
 | 
				
			||||||
      'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc',
 | 
					      'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc',
 | 
				
			||||||
      'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h',
 | 
					      'chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h',
 | 
				
			||||||
      'chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc',
 | 
					      'chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue