OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ | 59 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ |
60 !defined(WIDEVINE_CDM_IS_COMPONENT) | 60 !defined(WIDEVINE_CDM_IS_COMPONENT) |
61 #include "chrome/common/widevine_cdm_constants.h" | 61 #include "chrome/common/widevine_cdm_constants.h" |
62 #endif | 62 #endif |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
66 #if defined(ENABLE_PLUGINS) | 66 #if defined(ENABLE_PLUGINS) |
67 const char kPDFPluginMimeType[] = "application/pdf"; | |
68 const char kPDFPluginExtension[] = "pdf"; | 67 const char kPDFPluginExtension[] = "pdf"; |
69 const char kPDFPluginDescription[] = "Portable Document Format"; | 68 const char kPDFPluginDescription[] = "Portable Document Format"; |
70 const char kPDFPluginPrintPreviewMimeType[] = | |
71 "application/x-google-chrome-print-preview-pdf"; | |
72 const char kPDFPluginOutOfProcessMimeType[] = | 69 const char kPDFPluginOutOfProcessMimeType[] = |
73 "application/x-google-chrome-pdf"; | 70 "application/x-google-chrome-pdf"; |
74 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | | 71 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
75 ppapi::PERMISSION_DEV; | 72 ppapi::PERMISSION_DEV; |
76 | 73 |
77 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; | 74 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; |
78 const char kO1DPluginMimeType[] ="application/o1d"; | 75 const char kO1DPluginMimeType[] ="application/o1d"; |
79 const char kO1DPluginExtension[] = ""; | 76 const char kO1DPluginExtension[] = ""; |
80 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer"; | 77 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer"; |
81 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE | | 78 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE | |
82 ppapi::PERMISSION_DEV; | 79 ppapi::PERMISSION_DEV; |
83 | 80 |
84 const char kEffectsPluginName[] = "Google Talk Effects Plugin"; | 81 const char kEffectsPluginName[] = "Google Talk Effects Plugin"; |
85 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects"; | 82 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects"; |
86 const char kEffectsPluginExtension[] = ""; | 83 const char kEffectsPluginExtension[] = ""; |
87 const char kEffectsPluginDescription[] = "Google Talk Effects Plugin"; | 84 const char kEffectsPluginDescription[] = "Google Talk Effects Plugin"; |
88 const uint32 kEffectsPluginPermissions = ppapi::PERMISSION_PRIVATE | | 85 const uint32 kEffectsPluginPermissions = ppapi::PERMISSION_PRIVATE | |
89 ppapi::PERMISSION_DEV; | 86 ppapi::PERMISSION_DEV; |
90 | 87 |
91 const char kGTalkPluginName[] = "Google Talk Plugin"; | 88 const char kGTalkPluginName[] = "Google Talk Plugin"; |
92 const char kGTalkPluginMimeType[] ="application/googletalk"; | 89 const char kGTalkPluginMimeType[] ="application/googletalk"; |
93 const char kGTalkPluginExtension[] = ".googletalk"; | 90 const char kGTalkPluginExtension[] = ".googletalk"; |
94 const char kGTalkPluginDescription[] = "Google Talk Plugin"; | 91 const char kGTalkPluginDescription[] = "Google Talk Plugin"; |
95 const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE | | 92 const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE | |
96 ppapi::PERMISSION_DEV; | 93 ppapi::PERMISSION_DEV; |
97 | 94 |
| 95 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface; |
| 96 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module; |
| 97 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module; |
| 98 |
98 #if defined(ENABLE_REMOTING) | 99 #if defined(ENABLE_REMOTING) |
99 | 100 |
100 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface; | 101 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface; |
101 content::PepperPluginInfo::PPP_InitializeModuleFunc | 102 content::PepperPluginInfo::PPP_InitializeModuleFunc |
102 g_remoting_initialize_module; | 103 g_remoting_initialize_module; |
103 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module; | 104 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module; |
104 | 105 |
105 #if defined(GOOGLE_CHROME_BUILD) | 106 #if defined(GOOGLE_CHROME_BUILD) |
106 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer"; | 107 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer"; |
107 #else | 108 #else |
(...skipping 18 matching lines...) Expand all Loading... |
126 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; | 127 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; |
127 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; | 128 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; |
128 #endif | 129 #endif |
129 | 130 |
130 // 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 |
131 // 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, |
132 // 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 |
133 // not marked internal, aside from being automatically registered, they're just | 134 // not marked internal, aside from being automatically registered, they're just |
134 // regular plugins). | 135 // regular plugins). |
135 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { | 136 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { |
136 // PDF. | 137 content::PepperPluginInfo pdf_info; |
137 // | 138 pdf_info.is_internal = true; |
138 // Once we're sandboxed, we can't know if the PDF plugin is available or not; | 139 pdf_info.is_out_of_process = true; |
139 // but (on Linux) this function is always called once before we're sandboxed. | 140 pdf_info.name = ChromeContentClient::kPDFPluginName; |
140 // So the first time through test if the file is available and then skip the | 141 pdf_info.description = kPDFPluginDescription; |
141 // check on subsequent calls if yes. | 142 pdf_info.path = base::FilePath::FromUTF8Unsafe( |
142 static bool skip_pdf_file_check = false; | 143 ChromeContentClient::kPDFPluginPath); |
| 144 content::WebPluginMimeType pdf_mime_type( |
| 145 kPDFPluginOutOfProcessMimeType, |
| 146 kPDFPluginExtension, |
| 147 kPDFPluginDescription); |
| 148 pdf_info.mime_types.push_back(pdf_mime_type); |
| 149 pdf_info.internal_entry_points.get_interface = g_pdf_get_interface; |
| 150 pdf_info.internal_entry_points.initialize_module = g_pdf_initialize_module; |
| 151 pdf_info.internal_entry_points.shutdown_module = g_pdf_shutdown_module; |
| 152 pdf_info.permissions = kPDFPluginPermissions; |
| 153 plugins->push_back(pdf_info); |
| 154 |
143 base::FilePath path; | 155 base::FilePath path; |
144 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | |
145 if (skip_pdf_file_check || base::PathExists(path)) { | |
146 content::PepperPluginInfo pdf; | |
147 pdf.path = path; | |
148 pdf.name = ChromeContentClient::kPDFPluginName; | |
149 if (switches::OutOfProcessPdfEnabled()) { | |
150 pdf.is_out_of_process = true; | |
151 content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType, | |
152 kPDFPluginExtension, | |
153 kPDFPluginDescription); | |
154 pdf.mime_types.push_back(pdf_mime_type); | |
155 // TODO(raymes): Make print preview work with out of process PDF. | |
156 } else { | |
157 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | |
158 kPDFPluginExtension, | |
159 kPDFPluginDescription); | |
160 content::WebPluginMimeType print_preview_pdf_mime_type( | |
161 kPDFPluginPrintPreviewMimeType, | |
162 kPDFPluginExtension, | |
163 kPDFPluginDescription); | |
164 pdf.mime_types.push_back(pdf_mime_type); | |
165 pdf.mime_types.push_back(print_preview_pdf_mime_type); | |
166 } | |
167 pdf.permissions = kPDFPluginPermissions; | |
168 plugins->push_back(pdf); | |
169 | |
170 skip_pdf_file_check = true; | |
171 } | |
172 } | |
173 | 156 |
174 #if !defined(DISABLE_NACL) | 157 #if !defined(DISABLE_NACL) |
175 // Handle Native Client just like the PDF plugin. This means that it is | 158 // Handle Native Client just like the PDF plugin. This means that it is |
176 // enabled by default for the non-portable case. This allows apps installed | 159 // enabled by default for the non-portable case. This allows apps installed |
177 // from the Chrome Web Store to use NaCl even if the command line switch | 160 // from the Chrome Web Store to use NaCl even if the command line switch |
178 // isn't set. For other uses of NaCl we check for the command line switch. | 161 // isn't set. For other uses of NaCl we check for the command line switch. |
179 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 162 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
180 content::PepperPluginInfo nacl; | 163 content::PepperPluginInfo nacl; |
181 // The nacl plugin is now built into the Chromium binary. | 164 // The nacl plugin is now built into the Chromium binary. |
182 nacl.is_internal = true; | 165 nacl.is_internal = true; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 void ChromeContentClient::SetNaClEntryFunctions( | 430 void ChromeContentClient::SetNaClEntryFunctions( |
448 content::PepperPluginInfo::GetInterfaceFunc get_interface, | 431 content::PepperPluginInfo::GetInterfaceFunc get_interface, |
449 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, | 432 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, |
450 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { | 433 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { |
451 g_nacl_get_interface = get_interface; | 434 g_nacl_get_interface = get_interface; |
452 g_nacl_initialize_module = initialize_module; | 435 g_nacl_initialize_module = initialize_module; |
453 g_nacl_shutdown_module = shutdown_module; | 436 g_nacl_shutdown_module = shutdown_module; |
454 } | 437 } |
455 #endif | 438 #endif |
456 | 439 |
| 440 #if defined(ENABLE_PLUGINS) |
| 441 void ChromeContentClient::SetPDFEntryFunctions( |
| 442 content::PepperPluginInfo::GetInterfaceFunc get_interface, |
| 443 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, |
| 444 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { |
| 445 g_pdf_get_interface = get_interface; |
| 446 g_pdf_initialize_module = initialize_module; |
| 447 g_pdf_shutdown_module = shutdown_module; |
| 448 } |
| 449 #endif |
| 450 |
457 void ChromeContentClient::SetActiveURL(const GURL& url) { | 451 void ChromeContentClient::SetActiveURL(const GURL& url) { |
458 base::debug::SetCrashKeyValue(crash_keys::kActiveURL, | 452 base::debug::SetCrashKeyValue(crash_keys::kActiveURL, |
459 url.possibly_invalid_spec()); | 453 url.possibly_invalid_spec()); |
460 } | 454 } |
461 | 455 |
462 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { | 456 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { |
463 #if !defined(OS_ANDROID) | 457 #if !defined(OS_ANDROID) |
464 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID, | 458 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID, |
465 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id)); | 459 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id)); |
466 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID, | 460 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 int sandbox_type, | 550 int sandbox_type, |
557 int* sandbox_profile_resource_id) const { | 551 int* sandbox_profile_resource_id) const { |
558 DCHECK(sandbox_profile_resource_id); | 552 DCHECK(sandbox_profile_resource_id); |
559 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { | 553 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { |
560 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 554 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
561 return true; | 555 return true; |
562 } | 556 } |
563 return false; | 557 return false; |
564 } | 558 } |
565 #endif | 559 #endif |
OLD | NEW |