| 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/cpu.h" | 8 #include "base/cpu.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // but (on Linux) this function is always called once before we're sandboxed. | 133 // but (on Linux) this function is always called once before we're sandboxed. |
| 134 // So the first time through test if the file is available and then skip the | 134 // So the first time through test if the file is available and then skip the |
| 135 // check on subsequent calls if yes. | 135 // check on subsequent calls if yes. |
| 136 static bool skip_pdf_file_check = false; | 136 static bool skip_pdf_file_check = false; |
| 137 base::FilePath path; | 137 base::FilePath path; |
| 138 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 138 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
| 139 if (skip_pdf_file_check || base::PathExists(path)) { | 139 if (skip_pdf_file_check || base::PathExists(path)) { |
| 140 content::PepperPluginInfo pdf; | 140 content::PepperPluginInfo pdf; |
| 141 pdf.path = path; | 141 pdf.path = path; |
| 142 pdf.name = chrome::ChromeContentClient::kPDFPluginName; | 142 pdf.name = chrome::ChromeContentClient::kPDFPluginName; |
| 143 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | 143 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
| 144 kPDFPluginExtension, | 144 kPDFPluginExtension, |
| 145 kPDFPluginDescription); | 145 kPDFPluginDescription); |
| 146 webkit::WebPluginMimeType print_preview_pdf_mime_type( | 146 content::WebPluginMimeType print_preview_pdf_mime_type( |
| 147 kPDFPluginPrintPreviewMimeType, | 147 kPDFPluginPrintPreviewMimeType, |
| 148 kPDFPluginExtension, | 148 kPDFPluginExtension, |
| 149 kPDFPluginDescription); | 149 kPDFPluginDescription); |
| 150 pdf.mime_types.push_back(pdf_mime_type); | 150 pdf.mime_types.push_back(pdf_mime_type); |
| 151 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 151 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
| 152 pdf.permissions = kPDFPluginPermissions; | 152 pdf.permissions = kPDFPluginPermissions; |
| 153 plugins->push_back(pdf); | 153 plugins->push_back(pdf); |
| 154 | 154 |
| 155 skip_pdf_file_check = true; | 155 skip_pdf_file_check = true; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Handle Native Client just like the PDF plugin. This means that it is | 159 // Handle Native Client just like the PDF plugin. This means that it is |
| 160 // enabled by default for the non-portable case. This allows apps installed | 160 // enabled by default for the non-portable case. This allows apps installed |
| 161 // from the Chrome Web Store to use NaCl even if the command line switch | 161 // from the Chrome Web Store to use NaCl even if the command line switch |
| 162 // isn't set. For other uses of NaCl we check for the command line switch. | 162 // isn't set. For other uses of NaCl we check for the command line switch. |
| 163 // Specifically, Portable Native Client is only enabled by the command line | 163 // Specifically, Portable Native Client is only enabled by the command line |
| 164 // switch. | 164 // switch. |
| 165 static bool skip_nacl_file_check = false; | 165 static bool skip_nacl_file_check = false; |
| 166 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 166 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
| 167 if (skip_nacl_file_check || base::PathExists(path)) { | 167 if (skip_nacl_file_check || base::PathExists(path)) { |
| 168 content::PepperPluginInfo nacl; | 168 content::PepperPluginInfo nacl; |
| 169 nacl.path = path; | 169 nacl.path = path; |
| 170 nacl.name = chrome::ChromeContentClient::kNaClPluginName; | 170 nacl.name = chrome::ChromeContentClient::kNaClPluginName; |
| 171 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 171 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
| 172 kNaClPluginExtension, | 172 kNaClPluginExtension, |
| 173 kNaClPluginDescription); | 173 kNaClPluginDescription); |
| 174 nacl.mime_types.push_back(nacl_mime_type); | 174 nacl.mime_types.push_back(nacl_mime_type); |
| 175 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl)) { | 175 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl)) { |
| 176 webkit::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, | 176 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
| 177 kPnaclPluginExtension, | 177 kPnaclPluginExtension, |
| 178 kPnaclPluginDescription); | 178 kPnaclPluginDescription); |
| 179 nacl.mime_types.push_back(pnacl_mime_type); | 179 nacl.mime_types.push_back(pnacl_mime_type); |
| 180 } | 180 } |
| 181 nacl.permissions = kNaClPluginPermissions; | 181 nacl.permissions = kNaClPluginPermissions; |
| 182 plugins->push_back(nacl); | 182 plugins->push_back(nacl); |
| 183 | 183 |
| 184 skip_nacl_file_check = true; | 184 skip_nacl_file_check = true; |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced | 188 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced |
| 189 // entirely with o1d. | 189 // entirely with o1d. |
| 190 static bool skip_o3d_file_check = false; | 190 static bool skip_o3d_file_check = false; |
| 191 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { | 191 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { |
| 192 if (skip_o3d_file_check || base::PathExists(path)) { | 192 if (skip_o3d_file_check || base::PathExists(path)) { |
| 193 content::PepperPluginInfo o3d; | 193 content::PepperPluginInfo o3d; |
| 194 o3d.path = path; | 194 o3d.path = path; |
| 195 o3d.name = kO3DPluginName; | 195 o3d.name = kO3DPluginName; |
| 196 o3d.is_out_of_process = true; | 196 o3d.is_out_of_process = true; |
| 197 o3d.is_sandboxed = false; | 197 o3d.is_sandboxed = false; |
| 198 o3d.permissions = kO3DPluginPermissions; | 198 o3d.permissions = kO3DPluginPermissions; |
| 199 webkit::WebPluginMimeType o3d_mime_type(kO3DPluginMimeType, | 199 content::WebPluginMimeType o3d_mime_type(kO3DPluginMimeType, |
| 200 kO3DPluginExtension, | 200 kO3DPluginExtension, |
| 201 kO3DPluginDescription); | 201 kO3DPluginDescription); |
| 202 o3d.mime_types.push_back(o3d_mime_type); | 202 o3d.mime_types.push_back(o3d_mime_type); |
| 203 plugins->push_back(o3d); | 203 plugins->push_back(o3d); |
| 204 | 204 |
| 205 skip_o3d_file_check = true; | 205 skip_o3d_file_check = true; |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 static bool skip_o1d_file_check = false; | 209 static bool skip_o1d_file_check = false; |
| 210 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { | 210 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { |
| 211 if (skip_o1d_file_check || base::PathExists(path)) { | 211 if (skip_o1d_file_check || base::PathExists(path)) { |
| 212 content::PepperPluginInfo o1d; | 212 content::PepperPluginInfo o1d; |
| 213 o1d.path = path; | 213 o1d.path = path; |
| 214 o1d.name = kO1DPluginName; | 214 o1d.name = kO1DPluginName; |
| 215 o1d.is_out_of_process = true; | 215 o1d.is_out_of_process = true; |
| 216 o1d.is_sandboxed = false; | 216 o1d.is_sandboxed = false; |
| 217 o1d.permissions = kO1DPluginPermissions; | 217 o1d.permissions = kO1DPluginPermissions; |
| 218 webkit::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType, | 218 content::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType, |
| 219 kO1DPluginExtension, | 219 kO1DPluginExtension, |
| 220 kO1DPluginDescription); | 220 kO1DPluginDescription); |
| 221 o1d.mime_types.push_back(o1d_mime_type); | 221 o1d.mime_types.push_back(o1d_mime_type); |
| 222 plugins->push_back(o1d); | 222 plugins->push_back(o1d); |
| 223 | 223 |
| 224 skip_o1d_file_check = true; | 224 skip_o1d_file_check = true; |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 static bool skip_gtalk_file_check = false; | 228 static bool skip_gtalk_file_check = false; |
| 229 if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) { | 229 if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) { |
| 230 if (skip_gtalk_file_check || base::PathExists(path)) { | 230 if (skip_gtalk_file_check || base::PathExists(path)) { |
| 231 content::PepperPluginInfo gtalk; | 231 content::PepperPluginInfo gtalk; |
| 232 gtalk.path = path; | 232 gtalk.path = path; |
| 233 gtalk.name = kGTalkPluginName; | 233 gtalk.name = kGTalkPluginName; |
| 234 gtalk.is_out_of_process = true; | 234 gtalk.is_out_of_process = true; |
| 235 gtalk.is_sandboxed = false; | 235 gtalk.is_sandboxed = false; |
| 236 gtalk.permissions = kGTalkPluginPermissions; | 236 gtalk.permissions = kGTalkPluginPermissions; |
| 237 webkit::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType, | 237 content::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType, |
| 238 kGTalkPluginExtension, | 238 kGTalkPluginExtension, |
| 239 kGTalkPluginDescription); | 239 kGTalkPluginDescription); |
| 240 gtalk.mime_types.push_back(gtalk_mime_type); | 240 gtalk.mime_types.push_back(gtalk_mime_type); |
| 241 plugins->push_back(gtalk); | 241 plugins->push_back(gtalk); |
| 242 | 242 |
| 243 skip_gtalk_file_check = true; | 243 skip_gtalk_file_check = true; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ | 247 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ |
| 248 !defined(WIDEVINE_CDM_IS_COMPONENT) | 248 !defined(WIDEVINE_CDM_IS_COMPONENT) |
| 249 static bool skip_widevine_cdm_file_check = false; | 249 static bool skip_widevine_cdm_file_check = false; |
| 250 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { | 250 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { |
| 251 if (skip_widevine_cdm_file_check || base::PathExists(path)) { | 251 if (skip_widevine_cdm_file_check || base::PathExists(path)) { |
| 252 content::PepperPluginInfo widevine_cdm; | 252 content::PepperPluginInfo widevine_cdm; |
| 253 widevine_cdm.is_out_of_process = true; | 253 widevine_cdm.is_out_of_process = true; |
| 254 widevine_cdm.path = path; | 254 widevine_cdm.path = path; |
| 255 widevine_cdm.name = kWidevineCdmDisplayName; | 255 widevine_cdm.name = kWidevineCdmDisplayName; |
| 256 widevine_cdm.description = kWidevineCdmDescription; | 256 widevine_cdm.description = kWidevineCdmDescription; |
| 257 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; | 257 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; |
| 258 webkit::WebPluginMimeType widevine_cdm_mime_type( | 258 content::WebPluginMimeType widevine_cdm_mime_type( |
| 259 kWidevineCdmPluginMimeType, | 259 kWidevineCdmPluginMimeType, |
| 260 kWidevineCdmPluginExtension, | 260 kWidevineCdmPluginExtension, |
| 261 kWidevineCdmPluginMimeTypeDescription); | 261 kWidevineCdmPluginMimeTypeDescription); |
| 262 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); | 262 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); |
| 263 widevine_cdm.permissions = kWidevineCdmPluginPermissions; | 263 widevine_cdm.permissions = kWidevineCdmPluginPermissions; |
| 264 plugins->push_back(widevine_cdm); | 264 plugins->push_back(widevine_cdm); |
| 265 | 265 |
| 266 skip_widevine_cdm_file_check = true; | 266 skip_widevine_cdm_file_check = true; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && | 269 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && |
| 270 // !defined(WIDEVINE_CDM_IS_COMPONENT) | 270 // !defined(WIDEVINE_CDM_IS_COMPONENT) |
| 271 | 271 |
| 272 // The Remoting Viewer plugin is built-in. | 272 // The Remoting Viewer plugin is built-in. |
| 273 #if defined(ENABLE_REMOTING) | 273 #if defined(ENABLE_REMOTING) |
| 274 content::PepperPluginInfo info; | 274 content::PepperPluginInfo info; |
| 275 info.is_internal = true; | 275 info.is_internal = true; |
| 276 info.is_out_of_process = true; | 276 info.is_out_of_process = true; |
| 277 info.name = kRemotingViewerPluginName; | 277 info.name = kRemotingViewerPluginName; |
| 278 info.description = kRemotingViewerPluginDescription; | 278 info.description = kRemotingViewerPluginDescription; |
| 279 info.path = base::FilePath(kRemotingViewerPluginPath); | 279 info.path = base::FilePath(kRemotingViewerPluginPath); |
| 280 webkit::WebPluginMimeType remoting_mime_type( | 280 content::WebPluginMimeType remoting_mime_type( |
| 281 kRemotingViewerPluginMimeType, | 281 kRemotingViewerPluginMimeType, |
| 282 kRemotingViewerPluginMimeExtension, | 282 kRemotingViewerPluginMimeExtension, |
| 283 kRemotingViewerPluginMimeDescription); | 283 kRemotingViewerPluginMimeDescription); |
| 284 info.mime_types.push_back(remoting_mime_type); | 284 info.mime_types.push_back(remoting_mime_type); |
| 285 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; | 285 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; |
| 286 info.internal_entry_points.initialize_module = | 286 info.internal_entry_points.initialize_module = |
| 287 remoting::PPP_InitializeModule; | 287 remoting::PPP_InitializeModule; |
| 288 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; | 288 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; |
| 289 info.permissions = kRemotingViewerPluginPermissions; | 289 info.permissions = kRemotingViewerPluginPermissions; |
| 290 | 290 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 314 if (flash_version_numbers.size() < 2) | 314 if (flash_version_numbers.size() < 2) |
| 315 flash_version_numbers.push_back("2"); | 315 flash_version_numbers.push_back("2"); |
| 316 if (flash_version_numbers.size() < 3) | 316 if (flash_version_numbers.size() < 3) |
| 317 flash_version_numbers.push_back("999"); | 317 flash_version_numbers.push_back("999"); |
| 318 if (flash_version_numbers.size() < 4) | 318 if (flash_version_numbers.size() < 4) |
| 319 flash_version_numbers.push_back("999"); | 319 flash_version_numbers.push_back("999"); |
| 320 // E.g., "Shockwave Flash 10.2 r154": | 320 // E.g., "Shockwave Flash 10.2 r154": |
| 321 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + | 321 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + |
| 322 flash_version_numbers[1] + " r" + flash_version_numbers[2]; | 322 flash_version_numbers[1] + " r" + flash_version_numbers[2]; |
| 323 plugin.version = JoinString(flash_version_numbers, '.'); | 323 plugin.version = JoinString(flash_version_numbers, '.'); |
| 324 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, | 324 content::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, |
| 325 kFlashPluginSwfExtension, | 325 kFlashPluginSwfExtension, |
| 326 kFlashPluginSwfDescription); | 326 kFlashPluginSwfDescription); |
| 327 plugin.mime_types.push_back(swf_mime_type); | 327 plugin.mime_types.push_back(swf_mime_type); |
| 328 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, | 328 content::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, |
| 329 kFlashPluginSplExtension, | 329 kFlashPluginSplExtension, |
| 330 kFlashPluginSplDescription); | 330 kFlashPluginSplDescription); |
| 331 plugin.mime_types.push_back(spl_mime_type); | 331 plugin.mime_types.push_back(spl_mime_type); |
| 332 | 332 |
| 333 return plugin; | 333 return plugin; |
| 334 } | 334 } |
| 335 | 335 |
| 336 void AddPepperFlashFromCommandLine( | 336 void AddPepperFlashFromCommandLine( |
| 337 std::vector<content::PepperPluginInfo>* plugins) { | 337 std::vector<content::PepperPluginInfo>* plugins) { |
| 338 const CommandLine::StringType flash_path = | 338 const CommandLine::StringType flash_path = |
| 339 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 339 CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 340 switches::kPpapiFlashPath); | 340 switches::kPpapiFlashPath); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 485 } |
| 486 return false; | 486 return false; |
| 487 } | 487 } |
| 488 | 488 |
| 489 std::string ChromeContentClient::GetCarbonInterposePath() const { | 489 std::string ChromeContentClient::GetCarbonInterposePath() const { |
| 490 return std::string(kInterposeLibraryPath); | 490 return std::string(kInterposeLibraryPath); |
| 491 } | 491 } |
| 492 #endif | 492 #endif |
| 493 | 493 |
| 494 } // namespace chrome | 494 } // namespace chrome |
| OLD | NEW |