diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 22:47:27 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 22:47:27 +0000 |
commit | 388dd3a1688b3af37e804966fadfe83e6d46abc9 (patch) | |
tree | 35ece93cfa05154f7e3d542db2f4a0e03b4c804e /chrome/browser/plugin_service.cc | |
parent | 018cf36471451716c1fa14b99d7b2bbf780c883d (diff) | |
download | chromium_src-388dd3a1688b3af37e804966fadfe83e6d46abc9.zip chromium_src-388dd3a1688b3af37e804966fadfe83e6d46abc9.tar.gz chromium_src-388dd3a1688b3af37e804966fadfe83e6d46abc9.tar.bz2 |
Make disabled internal plugins stay disabled even when the version of Chrome changes.
This change is a bit hacky, but the proper change is to re-factor the plugins
stuff (and such a change wouldn't be M5-able).
BUG=42393
TEST=On Chrome with this CL, disable internal Flash. Update Chrome to a newer version (also with this CL). Check that internal Flash remains disabled. (Or hack the prefs file to test manually....)
Review URL: http://codereview.chromium.org/1969007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r-- | chrome/browser/plugin_service.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 12739c8..5565c0a 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -56,6 +56,13 @@ bool PluginService::enable_chrome_plugins_ = true; void PluginService::InitGlobalInstance(Profile* profile) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + bool update_internal_dir = false; + FilePath last_internal_dir = + profile->GetPrefs()->GetFilePath(prefs::kPluginsLastInternalDirectory); + FilePath cur_internal_dir; + if (PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &cur_internal_dir)) + update_internal_dir = (cur_internal_dir != last_internal_dir); + // Disable plugins listed as disabled in prefs. if (const ListValue* saved_plugins_list = profile->GetPrefs()->GetList(prefs::kPluginsPluginsList)) { @@ -71,8 +78,18 @@ void PluginService::InitGlobalInstance(Profile* profile) { FilePath::StringType path; bool enabled = true; plugin->GetBoolean(L"enabled", &enabled); - if (!enabled && plugin->GetString(L"path", &path)) - NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(path)); + if (!enabled && plugin->GetString(L"path", &path)) { + FilePath plugin_path(path); + NPAPI::PluginList::Singleton()->DisablePlugin(plugin_path); + + // If the internal plugin directory has changed and if the plugin looks + // internal, also disable it in the current internal plugins directory. + if (update_internal_dir && + plugin_path.DirName() == last_internal_dir) { + NPAPI::PluginList::Singleton()->DisablePlugin( + cur_internal_dir.Append(plugin_path.BaseName())); + } + } } } |