Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: chrome/common/chrome_content_client.cc

Issue 899033002: Revert of Combine PDF plugin into the Chromium binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | chrome/common/chrome_content_client_constants.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_content_client.cc
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index c8fb2ae65c145995aded39f837d61e96c678d6ab..587b2aaa95fbbfc17b23b3e353873ca54bcfd98f 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -64,8 +64,11 @@
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 |
@@ -91,10 +94,6 @@
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)
@@ -134,25 +133,43 @@
// not marked internal, aside from being automatically registered, they're just
// regular plugins).
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
- 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);
-
+ // 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;
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
@@ -437,17 +454,6 @@
}
#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());
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | chrome/common/chrome_content_client_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698