diff options
-rw-r--r-- | chrome/browser/plugin_updater.cc | 6 | ||||
-rw-r--r-- | chrome/common/pepper_plugin_registry.cc | 14 | ||||
-rw-r--r-- | chrome/common/pepper_plugin_registry.h | 5 |
3 files changed, 19 insertions, 6 deletions
diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc index a119c78..e1f1764 100644 --- a/chrome/browser/plugin_updater.cc +++ b/chrome/browser/plugin_updater.cc @@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "base/version.h" #include "chrome/browser/prefs/pref_service.h" @@ -17,6 +18,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" +#include "chrome/common/pepper_plugin_registry.h" #include "chrome/common/pref_names.h" #include "webkit/glue/plugins/plugin_group.h" #include "webkit/glue/plugins/plugin_list.h" @@ -138,7 +140,7 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { bool found_internal_pdf = false; bool force_enable_internal_pdf = false; - string16 pdf_group_name; + string16 pdf_group_name = ASCIIToUTF16(PepperPluginRegistry::kPDFPluginName); FilePath pdf_path; PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); FilePath::StringType pdf_path_str = pdf_path.value(); @@ -184,7 +186,6 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { if (FilePath::CompareIgnoreCase(path, pdf_path_str) == 0) { found_internal_pdf = true; - plugin->GetString("name", &pdf_group_name); if (!enabled && force_enable_internal_pdf) { enabled = true; plugin->SetBoolean("enabled", true); @@ -215,6 +216,7 @@ void PluginUpdater::DisablePluginGroupsFromPrefs(Profile* profile) { // The internal PDF plugin is disabled by default, and the user hasn't // overridden the default. NPAPI::PluginList::Singleton()->DisablePlugin(pdf_path); + NPAPI::PluginList::Singleton()->EnableGroup(false, pdf_group_name); } if (update_preferences) diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc index b6943af9a..7243665 100644 --- a/chrome/common/pepper_plugin_registry.cc +++ b/chrome/common/pepper_plugin_registry.cc @@ -15,6 +15,12 @@ #include "chrome/common/chrome_switches.h" #include "remoting/client/plugin/pepper_entrypoints.h" +const char* PepperPluginRegistry::kPDFPluginName = "Chrome PDF Viewer"; +const char* PepperPluginRegistry::kPDFPluginMimeType = "application/pdf"; +const char* PepperPluginRegistry::kPDFPluginExtension = "pdf"; +const char* PepperPluginRegistry::kPDFPluginDescription = + "Portable Document Format"; + PepperPluginInfo::PepperPluginInfo() : is_internal(false) { } @@ -115,10 +121,10 @@ void PepperPluginRegistry::GetExtraPlugins( if (skip_pdf_file_check || file_util::PathExists(path)) { PepperPluginInfo pdf; pdf.path = path; - pdf.name = "Chrome PDF Viewer"; - pdf.mime_types.push_back("application/pdf"); - pdf.file_extensions = "pdf"; - pdf.type_descriptions = "Portable Document Format"; + pdf.name = kPDFPluginName; + pdf.mime_types.push_back(kPDFPluginMimeType); + pdf.file_extensions = kPDFPluginExtension; + pdf.type_descriptions = kPDFPluginDescription; plugins->push_back(pdf); skip_pdf_file_check = true; diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h index 2938729..ebabc2e 100644 --- a/chrome/common/pepper_plugin_registry.h +++ b/chrome/common/pepper_plugin_registry.h @@ -29,6 +29,11 @@ struct PepperPluginInfo { // This class holds references to all of the known pepper plugin modules. class PepperPluginRegistry { public: + static const char* kPDFPluginName; + static const char* kPDFPluginMimeType; + static const char* kPDFPluginExtension; + static const char* kPDFPluginDescription; + static PepperPluginRegistry* GetInstance(); // Returns the list of known pepper plugins. This method is static so that |