| 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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 42 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 43 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 43 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 44 | 44 |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 #include "base/win/registry.h" | 46 #include "base/win/registry.h" |
| 47 #include "base/win/windows_version.h" | 47 #include "base/win/windows_version.h" |
| 48 #elif defined(OS_MACOSX) | 48 #elif defined(OS_MACOSX) |
| 49 #include "components/nacl/common/nacl_sandbox_type_mac.h" | 49 #include "components/nacl/common/nacl_sandbox_type_mac.h" |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 #if !defined(DISABLE_NACL) |
| 53 #include "ppapi/native_client/src/trusted/plugin/ppapi_entrypoints.h" |
| 54 #endif |
| 55 |
| 52 #if defined(ENABLE_REMOTING) | 56 #if defined(ENABLE_REMOTING) |
| 53 #include "remoting/client/plugin/pepper_entrypoints.h" | 57 #include "remoting/client/plugin/pepper_entrypoints.h" |
| 54 #endif | 58 #endif |
| 55 | 59 |
| 56 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ | 60 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ |
| 57 !defined(WIDEVINE_CDM_IS_COMPONENT) | 61 !defined(WIDEVINE_CDM_IS_COMPONENT) |
| 58 #include "chrome/common/widevine_cdm_constants.h" | 62 #include "chrome/common/widevine_cdm_constants.h" |
| 59 #endif | 63 #endif |
| 60 | 64 |
| 61 namespace { | 65 namespace { |
| 62 | 66 |
| 63 const char kPDFPluginMimeType[] = "application/pdf"; | 67 const char kPDFPluginMimeType[] = "application/pdf"; |
| 64 const char kPDFPluginExtension[] = "pdf"; | 68 const char kPDFPluginExtension[] = "pdf"; |
| 65 const char kPDFPluginDescription[] = "Portable Document Format"; | 69 const char kPDFPluginDescription[] = "Portable Document Format"; |
| 66 const char kPDFPluginPrintPreviewMimeType[] = | 70 const char kPDFPluginPrintPreviewMimeType[] = |
| 67 "application/x-google-chrome-print-preview-pdf"; | 71 "application/x-google-chrome-print-preview-pdf"; |
| 68 const char kPDFPluginOutOfProcessMimeType[] = | 72 const char kPDFPluginOutOfProcessMimeType[] = |
| 69 "application/x-google-chrome-pdf"; | 73 "application/x-google-chrome-pdf"; |
| 70 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | | 74 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 71 ppapi::PERMISSION_DEV; | 75 ppapi::PERMISSION_DEV; |
| 72 | 76 |
| 77 #if !defined(DISABLE_NACL) |
| 73 const char kNaClPluginMimeType[] = "application/x-nacl"; | 78 const char kNaClPluginMimeType[] = "application/x-nacl"; |
| 74 const char kNaClPluginExtension[] = ""; | 79 const char kNaClPluginExtension[] = ""; |
| 75 const char kNaClPluginDescription[] = "Native Client Executable"; | 80 const char kNaClPluginDescription[] = "Native Client Executable"; |
| 76 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | | 81 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 77 ppapi::PERMISSION_DEV; | 82 ppapi::PERMISSION_DEV; |
| 78 | 83 |
| 79 const char kPnaclPluginMimeType[] = "application/x-pnacl"; | 84 const char kPnaclPluginMimeType[] = "application/x-pnacl"; |
| 80 const char kPnaclPluginExtension[] = ""; | 85 const char kPnaclPluginExtension[] = ""; |
| 81 const char kPnaclPluginDescription[] = "Portable Native Client Executable"; | 86 const char kPnaclPluginDescription[] = "Portable Native Client Executable"; |
| 87 #endif // !defined(DISABLE_NACL) |
| 82 | 88 |
| 83 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; | 89 const char kO1DPluginName[] = "Google Talk Plugin Video Renderer"; |
| 84 const char kO1DPluginMimeType[] ="application/o1d"; | 90 const char kO1DPluginMimeType[] ="application/o1d"; |
| 85 const char kO1DPluginExtension[] = ""; | 91 const char kO1DPluginExtension[] = ""; |
| 86 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer"; | 92 const char kO1DPluginDescription[] = "Google Talk Plugin Video Renderer"; |
| 87 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE | | 93 const uint32 kO1DPluginPermissions = ppapi::PERMISSION_PRIVATE | |
| 88 ppapi::PERMISSION_DEV; | 94 ppapi::PERMISSION_DEV; |
| 89 | 95 |
| 90 const char kEffectsPluginName[] = "Google Talk Effects Plugin"; | 96 const char kEffectsPluginName[] = "Google Talk Effects Plugin"; |
| 91 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects"; | 97 const char kEffectsPluginMimeType[] ="application/x-ppapi-hangouts-effects"; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 pdf.mime_types.push_back(pdf_mime_type); | 165 pdf.mime_types.push_back(pdf_mime_type); |
| 160 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 166 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
| 161 } | 167 } |
| 162 pdf.permissions = kPDFPluginPermissions; | 168 pdf.permissions = kPDFPluginPermissions; |
| 163 plugins->push_back(pdf); | 169 plugins->push_back(pdf); |
| 164 | 170 |
| 165 skip_pdf_file_check = true; | 171 skip_pdf_file_check = true; |
| 166 } | 172 } |
| 167 } | 173 } |
| 168 | 174 |
| 175 #if !defined(DISABLE_NACL) |
| 169 // Handle Native Client just like the PDF plugin. This means that it is | 176 // Handle Native Client just like the PDF plugin. This means that it is |
| 170 // enabled by default for the non-portable case. This allows apps installed | 177 // enabled by default for the non-portable case. This allows apps installed |
| 171 // from the Chrome Web Store to use NaCl even if the command line switch | 178 // from the Chrome Web Store to use NaCl even if the command line switch |
| 172 // isn't set. For other uses of NaCl we check for the command line switch. | 179 // isn't set. For other uses of NaCl we check for the command line switch. |
| 173 static bool skip_nacl_file_check = false; | |
| 174 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 180 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
| 175 if (skip_nacl_file_check || base::PathExists(path)) { | 181 content::PepperPluginInfo nacl; |
| 176 content::PepperPluginInfo nacl; | 182 // The nacl plugin is now built into the Chromium binary. |
| 177 nacl.path = path; | 183 nacl.is_internal = true; |
| 178 nacl.name = ChromeContentClient::kNaClPluginName; | 184 nacl.path = path; |
| 179 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 185 nacl.name = ChromeContentClient::kNaClPluginName; |
| 180 kNaClPluginExtension, | 186 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
| 181 kNaClPluginDescription); | 187 kNaClPluginExtension, |
| 182 nacl.mime_types.push_back(nacl_mime_type); | 188 kNaClPluginDescription); |
| 183 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, | 189 nacl.mime_types.push_back(nacl_mime_type); |
| 184 kPnaclPluginExtension, | 190 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
| 185 kPnaclPluginDescription); | 191 kPnaclPluginExtension, |
| 186 nacl.mime_types.push_back(pnacl_mime_type); | 192 kPnaclPluginDescription); |
| 187 nacl.permissions = kNaClPluginPermissions; | 193 nacl.mime_types.push_back(pnacl_mime_type); |
| 188 plugins->push_back(nacl); | 194 nacl.internal_entry_points.get_interface = nacl_plugin::PPP_GetInterface; |
| 189 | 195 nacl.internal_entry_points.initialize_module = |
| 190 skip_nacl_file_check = true; | 196 nacl_plugin::PPP_InitializeModule; |
| 191 } | 197 nacl.internal_entry_points.shutdown_module = |
| 198 nacl_plugin::PPP_ShutdownModule; |
| 199 nacl.permissions = kNaClPluginPermissions; |
| 200 plugins->push_back(nacl); |
| 192 } | 201 } |
| 202 #endif // !defined(DISABLE_NACL) |
| 193 | 203 |
| 194 static bool skip_o1d_file_check = false; | 204 static bool skip_o1d_file_check = false; |
| 195 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { | 205 if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { |
| 196 if (skip_o1d_file_check || base::PathExists(path)) { | 206 if (skip_o1d_file_check || base::PathExists(path)) { |
| 197 content::PepperPluginInfo o1d; | 207 content::PepperPluginInfo o1d; |
| 198 o1d.path = path; | 208 o1d.path = path; |
| 199 o1d.name = kO1DPluginName; | 209 o1d.name = kO1DPluginName; |
| 200 o1d.is_out_of_process = true; | 210 o1d.is_out_of_process = true; |
| 201 o1d.is_sandboxed = false; | 211 o1d.is_sandboxed = false; |
| 202 o1d.permissions = kO1DPluginPermissions; | 212 o1d.permissions = kO1DPluginPermissions; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 int sandbox_type, | 538 int sandbox_type, |
| 529 int* sandbox_profile_resource_id) const { | 539 int* sandbox_profile_resource_id) const { |
| 530 DCHECK(sandbox_profile_resource_id); | 540 DCHECK(sandbox_profile_resource_id); |
| 531 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { | 541 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { |
| 532 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 542 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
| 533 return true; | 543 return true; |
| 534 } | 544 } |
| 535 return false; | 545 return false; |
| 536 } | 546 } |
| 537 #endif | 547 #endif |
| OLD | NEW |