Index: chrome/common/chrome_content_client.cc |
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc |
index 587b2aaa95fbbfc17b23b3e353873ca54bcfd98f..c8fb2ae65c145995aded39f837d61e96c678d6ab 100644 |
--- a/chrome/common/chrome_content_client.cc |
+++ b/chrome/common/chrome_content_client.cc |
@@ -64,11 +64,8 @@ |
namespace { |
#if defined(ENABLE_PLUGINS) |
-const char kPDFPluginMimeType[] = "application/pdf"; |
const char kPDFPluginExtension[] = "pdf"; |
const char kPDFPluginDescription[] = "Portable Document Format"; |
-const char kPDFPluginPrintPreviewMimeType[] = |
- "application/x-google-chrome-print-preview-pdf"; |
const char kPDFPluginOutOfProcessMimeType[] = |
"application/x-google-chrome-pdf"; |
const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
@@ -95,6 +92,10 @@ const char kGTalkPluginDescription[] = "Google Talk Plugin"; |
const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE | |
ppapi::PERMISSION_DEV; |
+content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface; |
+content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module; |
+content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module; |
+ |
#if defined(ENABLE_REMOTING) |
content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface; |
@@ -133,43 +134,25 @@ content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; |
// not marked internal, aside from being automatically registered, they're just |
// regular plugins). |
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { |
- // PDF. |
- // |
- // Once we're sandboxed, we can't know if the PDF plugin is available or not; |
- // but (on Linux) this function is always called once before we're sandboxed. |
- // So the first time through test if the file is available and then skip the |
- // check on subsequent calls if yes. |
- static bool skip_pdf_file_check = false; |
+ content::PepperPluginInfo pdf_info; |
+ pdf_info.is_internal = true; |
+ pdf_info.is_out_of_process = true; |
+ pdf_info.name = ChromeContentClient::kPDFPluginName; |
+ pdf_info.description = kPDFPluginDescription; |
+ pdf_info.path = base::FilePath::FromUTF8Unsafe( |
+ ChromeContentClient::kPDFPluginPath); |
+ content::WebPluginMimeType pdf_mime_type( |
+ kPDFPluginOutOfProcessMimeType, |
+ kPDFPluginExtension, |
+ kPDFPluginDescription); |
+ pdf_info.mime_types.push_back(pdf_mime_type); |
+ pdf_info.internal_entry_points.get_interface = g_pdf_get_interface; |
+ pdf_info.internal_entry_points.initialize_module = g_pdf_initialize_module; |
+ pdf_info.internal_entry_points.shutdown_module = g_pdf_shutdown_module; |
+ pdf_info.permissions = kPDFPluginPermissions; |
+ plugins->push_back(pdf_info); |
+ |
base::FilePath path; |
- if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
- if (skip_pdf_file_check || base::PathExists(path)) { |
- content::PepperPluginInfo pdf; |
- pdf.path = path; |
- pdf.name = ChromeContentClient::kPDFPluginName; |
- if (switches::OutOfProcessPdfEnabled()) { |
- pdf.is_out_of_process = true; |
- content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType, |
- kPDFPluginExtension, |
- kPDFPluginDescription); |
- pdf.mime_types.push_back(pdf_mime_type); |
- // TODO(raymes): Make print preview work with out of process PDF. |
- } else { |
- content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
- kPDFPluginExtension, |
- kPDFPluginDescription); |
- content::WebPluginMimeType print_preview_pdf_mime_type( |
- kPDFPluginPrintPreviewMimeType, |
- kPDFPluginExtension, |
- kPDFPluginDescription); |
- pdf.mime_types.push_back(pdf_mime_type); |
- pdf.mime_types.push_back(print_preview_pdf_mime_type); |
- } |
- pdf.permissions = kPDFPluginPermissions; |
- plugins->push_back(pdf); |
- |
- skip_pdf_file_check = true; |
- } |
- } |
#if !defined(DISABLE_NACL) |
// Handle Native Client just like the PDF plugin. This means that it is |
@@ -454,6 +437,17 @@ void ChromeContentClient::SetNaClEntryFunctions( |
} |
#endif |
+#if defined(ENABLE_PLUGINS) |
+void ChromeContentClient::SetPDFEntryFunctions( |
+ content::PepperPluginInfo::GetInterfaceFunc get_interface, |
+ content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, |
+ content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { |
+ g_pdf_get_interface = get_interface; |
+ g_pdf_initialize_module = initialize_module; |
+ g_pdf_shutdown_module = shutdown_module; |
+} |
+#endif |
+ |
void ChromeContentClient::SetActiveURL(const GURL& url) { |
base::debug::SetCrashKeyValue(crash_keys::kActiveURL, |
url.possibly_invalid_spec()); |