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

Unified Diff: chrome/browser/plugins/plugin_prefs.cc

Issue 12463018: Merge 185431 - Ignore the disabled state of component-updated PPAPI Flash for once. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 9 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 | « no previous file | chrome/browser/plugins/plugin_prefs_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_prefs.cc
===================================================================
--- chrome/browser/plugins/plugin_prefs.cc (revision 186478)
+++ chrome/browser/plugins/plugin_prefs.cc (working copy)
@@ -43,6 +43,19 @@
// go to disk.
const int64 kPluginUpdateDelayMs = 60 * 1000;
+bool IsComponentUpdatedPepperFlash(const FilePath& plugin) {
+ if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) {
+ FilePath component_updated_pepper_flash_dir;
+ if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN,
+ &component_updated_pepper_flash_dir) &&
+ component_updated_pepper_flash_dir.IsParent(plugin)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // namespace
PluginPrefs::PluginState::PluginState() {
@@ -68,16 +81,11 @@
FilePath PluginPrefs::PluginState::ConvertMapKey(const FilePath& plugin) const {
// Keep the state of component-updated and bundled Pepper Flash in sync.
- if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) {
- FilePath component_updated_pepper_flash_dir;
- if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN,
- &component_updated_pepper_flash_dir) &&
- component_updated_pepper_flash_dir.IsParent(plugin)) {
- FilePath bundled_pepper_flash;
- if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN,
- &bundled_pepper_flash)) {
- return bundled_pepper_flash;
- }
+ if (IsComponentUpdatedPepperFlash(plugin)) {
+ FilePath bundled_pepper_flash;
+ if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN,
+ &bundled_pepper_flash)) {
+ return bundled_pepper_flash;
}
}
@@ -352,7 +360,7 @@
bool migrate_to_pepper_flash = false;
#if defined(OS_WIN) || defined(OS_MACOSX)
- // If bundled NPAPI Flash is enabled while Peppper Flash is disabled, we
+ // If bundled NPAPI Flash is enabled while Pepper Flash is disabled, we
// would like to turn Pepper Flash on. And we only want to do it once.
// TODO(yzshen): Remove all |migrate_to_pepper_flash|-related code after it
// has been run once by most users. (Maybe Chrome 24 or Chrome 25.)
@@ -363,6 +371,19 @@
}
#endif
+ bool remove_component_pepper_flash_settings = false;
+ // If component-updated Pepper Flash is disabled, we would like to remove that
+ // settings item. And we only want to do it once. (Please see the comments of
+ // kPluginsRemovedOldComponentPepperFlashSettings for why.)
+ // TODO(yzshen): Remove all |remove_component_pepper_flash_settings|-related
+ // code after it has been run once by most users.
+ if (!prefs_->GetBoolean(
+ prefs::kPluginsRemovedOldComponentPepperFlashSettings)) {
+ prefs_->SetBoolean(prefs::kPluginsRemovedOldComponentPepperFlashSettings,
+ true);
+ remove_component_pepper_flash_settings = true;
+ }
+
{ // Scoped update of prefs::kPluginsPluginsList.
ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList);
ListValue* saved_plugins_list = update.Get();
@@ -378,7 +399,11 @@
PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &pepper_flash);
}
- for (ListValue::const_iterator it = saved_plugins_list->begin();
+ // Used when |remove_component_pepper_flash_settings| is set to true.
+ ListValue::iterator component_pepper_flash_node =
+ saved_plugins_list->end();
+
+ for (ListValue::iterator it = saved_plugins_list->begin();
it != saved_plugins_list->end();
++it) {
if (!(*it)->IsType(Value::TYPE_DICTIONARY)) {
@@ -457,6 +482,13 @@
FilePath::CompareEqualIgnoreCase(path, pepper_flash.value())) {
if (!enabled)
pepper_flash_node = plugin;
+ } else if (remove_component_pepper_flash_settings &&
+ IsComponentUpdatedPepperFlash(plugin_path)) {
+ if (!enabled) {
+ component_pepper_flash_node = it;
+ // Skip setting |enabled| into |plugin_state_|.
+ continue;
+ }
}
plugin_state_.Set(plugin_path, enabled);
@@ -479,6 +511,11 @@
pepper_flash_node->SetBoolean("enabled", true);
plugin_state_.Set(pepper_flash, true);
}
+
+ if (component_pepper_flash_node != saved_plugins_list->end()) {
+ DCHECK(remove_component_pepper_flash_settings);
+ saved_plugins_list->Erase(component_pepper_flash_node, NULL);
+ }
} else {
// If the saved plugin list is empty, then the call to UpdatePreferences()
// below failed in an earlier run, possibly because the user closed the
« no previous file with comments | « no previous file | chrome/browser/plugins/plugin_prefs_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698