| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { | 130 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { |
| 131 // PDF. | 131 // PDF. |
| 132 // | 132 // |
| 133 // Once we're sandboxed, we can't know if the PDF plugin is available or not; | 133 // Once we're sandboxed, we can't know if the PDF plugin is available or not; |
| 134 // but (on Linux) this function is always called once before we're sandboxed. | 134 // but (on Linux) this function is always called once before we're sandboxed. |
| 135 // So the first time through test if the file is available and then skip the | 135 // So the first time through test if the file is available and then skip the |
| 136 // check on subsequent calls if yes. | 136 // check on subsequent calls if yes. |
| 137 static bool skip_pdf_file_check = false; | 137 static bool skip_pdf_file_check = false; |
| 138 base::FilePath path; | 138 base::FilePath path; |
| 139 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 139 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
| 140 if (skip_pdf_file_check || file_util::PathExists(path)) { | 140 if (skip_pdf_file_check || base::PathExists(path)) { |
| 141 content::PepperPluginInfo pdf; | 141 content::PepperPluginInfo pdf; |
| 142 pdf.path = path; | 142 pdf.path = path; |
| 143 pdf.name = chrome::ChromeContentClient::kPDFPluginName; | 143 pdf.name = chrome::ChromeContentClient::kPDFPluginName; |
| 144 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | 144 webkit::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
| 145 kPDFPluginExtension, | 145 kPDFPluginExtension, |
| 146 kPDFPluginDescription); | 146 kPDFPluginDescription); |
| 147 webkit::WebPluginMimeType print_preview_pdf_mime_type( | 147 webkit::WebPluginMimeType print_preview_pdf_mime_type( |
| 148 kPDFPluginPrintPreviewMimeType, | 148 kPDFPluginPrintPreviewMimeType, |
| 149 kPDFPluginExtension, | 149 kPDFPluginExtension, |
| 150 kPDFPluginDescription); | 150 kPDFPluginDescription); |
| 151 pdf.mime_types.push_back(pdf_mime_type); | 151 pdf.mime_types.push_back(pdf_mime_type); |
| 152 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 152 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
| 153 pdf.permissions = kPDFPluginPermissions; | 153 pdf.permissions = kPDFPluginPermissions; |
| 154 plugins->push_back(pdf); | 154 plugins->push_back(pdf); |
| 155 | 155 |
| 156 skip_pdf_file_check = true; | 156 skip_pdf_file_check = true; |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Handle Native Client just like the PDF plugin. This means that it is | 160 // Handle Native Client just like the PDF plugin. This means that it is |
| 161 // enabled by default for the non-portable case. This allows apps installed | 161 // enabled by default for the non-portable case. This allows apps installed |
| 162 // from the Chrome Web Store to use NaCl even if the command line switch | 162 // from the Chrome Web Store to use NaCl even if the command line switch |
| 163 // isn't set. For other uses of NaCl we check for the command line switch. | 163 // isn't set. For other uses of NaCl we check for the command line switch. |
| 164 // Specifically, Portable Native Client is only enabled by the command line | 164 // Specifically, Portable Native Client is only enabled by the command line |
| 165 // switch. | 165 // switch. |
| 166 static bool skip_nacl_file_check = false; | 166 static bool skip_nacl_file_check = false; |
| 167 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 167 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
| 168 if (skip_nacl_file_check || file_util::PathExists(path)) { | 168 if (skip_nacl_file_check || base::PathExists(path)) { |
| 169 content::PepperPluginInfo nacl; | 169 content::PepperPluginInfo nacl; |
| 170 nacl.path = path; | 170 nacl.path = path; |
| 171 nacl.name = chrome::ChromeContentClient::kNaClPluginName; | 171 nacl.name = chrome::ChromeContentClient::kNaClPluginName; |
| 172 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 172 webkit::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
| 173 kNaClPluginExtension, | 173 kNaClPluginExtension, |
| 174 kNaClPluginDescription); | 174 kNaClPluginDescription); |
| 175 nacl.mime_types.push_back(nacl_mime_type); | 175 nacl.mime_types.push_back(nacl_mime_type); |
| 176 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl)) { | 176 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl)) { |
| 177 webkit::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, | 177 webkit::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
| 178 kPnaclPluginExtension, | 178 kPnaclPluginExtension, |
| 179 kPnaclPluginDescription); | 179 kPnaclPluginDescription); |
| 180 nacl.mime_types.push_back(pnacl_mime_type); | 180 nacl.mime_types.push_back(pnacl_mime_type); |
| 181 } | 181 } |
| 182 nacl.permissions = kNaClPluginPermissions; | 182 nacl.permissions = kNaClPluginPermissions; |
| 183 plugins->push_back(nacl); | 183 plugins->push_back(nacl); |
| 184 | 184 |
| 185 skip_nacl_file_check = true; | 185 skip_nacl_file_check = true; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced | 189 // TODO(jhorwich|noahric): Remove o3d ppapi code once o3d is replaced |
| 190 // entirely with o1d. | 190 // entirely with o1d. |
| 191 static bool skip_o3d_file_check = false; | 191 static bool skip_o3d_file_check = false; |
| 192 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { | 192 if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { |
| 193 if (skip_o3d_file_check || file_util::PathExists(path)) { | 193 if (skip_o3d_file_check || base::PathExists(path)) { |
| 194 content::PepperPluginInfo o3d; | 194 content::PepperPluginInfo o3d; |
| 195 o3d.path = path; | 195 o3d.path = path; |
| 196 o3d.name = kO3DPluginName; | 196 o3d.name = kO3DPluginName; |
| 197 o3d.is_out_of_process = true; | 197 o3d.is_out_of_process = true; |
| 198 o3d.is_sandboxed = false; | 198 o3d.is_sandboxed = false; |
| 199 o3d.permissions = kO3DPluginPermissions; | 199 o3d.permissions = kO3DPluginPermissions; |
| 200 webkit::WebPluginMimeType o3d_mime_type(kO3DPluginMimeType, | 200 webkit::WebPluginMimeType o3d_mime_type(kO3DPluginMimeType, |
| 201 kO3DPluginExtension, | 201 kO3DPluginExtension, |
| 202 kO3DPluginDescription); | 202 kO3DPluginDescription); |
| 203 o3d.mime_types.push_back(o3d_mime_type); | 203 o3d.mime_types.push_back(o3d_mime_type); |
| 204 plugins->push_back(o3d); | 204 plugins->push_back(o3d); |
| 205 | 205 |
| 206 skip_o3d_file_check = true; | 206 skip_o3d_file_check = true; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 static bool skip_o1d_file_check = false; | 210 static bool skip_o1d_file_check = false; |
| 211 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { | 211 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { |
| 212 if (skip_o1d_file_check || file_util::PathExists(path)) { | 212 if (skip_o1d_file_check || base::PathExists(path)) { |
| 213 content::PepperPluginInfo o1d; | 213 content::PepperPluginInfo o1d; |
| 214 o1d.path = path; | 214 o1d.path = path; |
| 215 o1d.name = kO1DPluginName; | 215 o1d.name = kO1DPluginName; |
| 216 o1d.is_out_of_process = true; | 216 o1d.is_out_of_process = true; |
| 217 o1d.is_sandboxed = false; | 217 o1d.is_sandboxed = false; |
| 218 o1d.permissions = kO1DPluginPermissions; | 218 o1d.permissions = kO1DPluginPermissions; |
| 219 webkit::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType, | 219 webkit::WebPluginMimeType o1d_mime_type(kO1DPluginMimeType, |
| 220 kO1DPluginExtension, | 220 kO1DPluginExtension, |
| 221 kO1DPluginDescription); | 221 kO1DPluginDescription); |
| 222 o1d.mime_types.push_back(o1d_mime_type); | 222 o1d.mime_types.push_back(o1d_mime_type); |
| 223 plugins->push_back(o1d); | 223 plugins->push_back(o1d); |
| 224 | 224 |
| 225 skip_o1d_file_check = true; | 225 skip_o1d_file_check = true; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 static bool skip_gtalk_file_check = false; | 229 static bool skip_gtalk_file_check = false; |
| 230 if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) { | 230 if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) { |
| 231 if (skip_gtalk_file_check || file_util::PathExists(path)) { | 231 if (skip_gtalk_file_check || base::PathExists(path)) { |
| 232 content::PepperPluginInfo gtalk; | 232 content::PepperPluginInfo gtalk; |
| 233 gtalk.path = path; | 233 gtalk.path = path; |
| 234 gtalk.name = kGTalkPluginName; | 234 gtalk.name = kGTalkPluginName; |
| 235 gtalk.is_out_of_process = true; | 235 gtalk.is_out_of_process = true; |
| 236 gtalk.is_sandboxed = false; | 236 gtalk.is_sandboxed = false; |
| 237 gtalk.permissions = kGTalkPluginPermissions; | 237 gtalk.permissions = kGTalkPluginPermissions; |
| 238 webkit::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType, | 238 webkit::WebPluginMimeType gtalk_mime_type(kGTalkPluginMimeType, |
| 239 kGTalkPluginExtension, | 239 kGTalkPluginExtension, |
| 240 kGTalkPluginDescription); | 240 kGTalkPluginDescription); |
| 241 gtalk.mime_types.push_back(gtalk_mime_type); | 241 gtalk.mime_types.push_back(gtalk_mime_type); |
| 242 plugins->push_back(gtalk); | 242 plugins->push_back(gtalk); |
| 243 | 243 |
| 244 skip_gtalk_file_check = true; | 244 skip_gtalk_file_check = true; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ | 248 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ |
| 249 !defined(WIDEVINE_CDM_IS_COMPONENT) | 249 !defined(WIDEVINE_CDM_IS_COMPONENT) |
| 250 static bool skip_widevine_cdm_file_check = false; | 250 static bool skip_widevine_cdm_file_check = false; |
| 251 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { | 251 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { |
| 252 if (skip_widevine_cdm_file_check || file_util::PathExists(path)) { | 252 if (skip_widevine_cdm_file_check || base::PathExists(path)) { |
| 253 content::PepperPluginInfo widevine_cdm; | 253 content::PepperPluginInfo widevine_cdm; |
| 254 widevine_cdm.is_out_of_process = true; | 254 widevine_cdm.is_out_of_process = true; |
| 255 widevine_cdm.path = path; | 255 widevine_cdm.path = path; |
| 256 widevine_cdm.name = kWidevineCdmDisplayName; | 256 widevine_cdm.name = kWidevineCdmDisplayName; |
| 257 widevine_cdm.description = kWidevineCdmDescription; | 257 widevine_cdm.description = kWidevineCdmDescription; |
| 258 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; | 258 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; |
| 259 webkit::WebPluginMimeType widevine_cdm_mime_type( | 259 webkit::WebPluginMimeType widevine_cdm_mime_type( |
| 260 kWidevineCdmPluginMimeType, | 260 kWidevineCdmPluginMimeType, |
| 261 kWidevineCdmPluginExtension, | 261 kWidevineCdmPluginExtension, |
| 262 kWidevineCdmPluginMimeTypeDescription); | 262 kWidevineCdmPluginMimeTypeDescription); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 490 } |
| 491 return false; | 491 return false; |
| 492 } | 492 } |
| 493 | 493 |
| 494 std::string ChromeContentClient::GetCarbonInterposePath() const { | 494 std::string ChromeContentClient::GetCarbonInterposePath() const { |
| 495 return std::string(kInterposeLibraryPath); | 495 return std::string(kInterposeLibraryPath); |
| 496 } | 496 } |
| 497 #endif | 497 #endif |
| 498 | 498 |
| 499 } // namespace chrome | 499 } // namespace chrome |
| OLD | NEW |