Index: chrome/browser/plugin_service.cc |
=================================================================== |
--- chrome/browser/plugin_service.cc (revision 46737) |
+++ chrome/browser/plugin_service.cc (working copy) |
@@ -17,6 +17,7 @@ |
#include "chrome/browser/chrome_thread.h" |
#include "chrome/browser/extensions/extensions_service.h" |
#include "chrome/browser/plugin_process_host.h" |
+#include "chrome/browser/plugin_updater.h" |
#include "chrome/browser/pref_service.h" |
#include "chrome/browser/profile.h" |
#include "chrome/browser/renderer_host/render_process_host.h" |
@@ -56,43 +57,9 @@ |
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); |
+ // We first group the plugins and then figure out which groups to disable. |
+ PluginUpdater::GetInstance()->DisablePluginGroupsFromPrefs(profile); |
- // Disable plugins listed as disabled in prefs. |
- if (const ListValue* saved_plugins_list = |
- profile->GetPrefs()->GetList(prefs::kPluginsPluginsList)) { |
- for (ListValue::const_iterator it = saved_plugins_list->begin(); |
- it != saved_plugins_list->end(); |
- ++it) { |
- if (!(*it)->IsType(Value::TYPE_DICTIONARY)) { |
- LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList; |
- continue; // Oops, don't know what to do with this item. |
- } |
- |
- DictionaryValue* plugin = static_cast<DictionaryValue*>(*it); |
- FilePath::StringType path; |
- bool enabled = true; |
- plugin->GetBoolean(L"enabled", &enabled); |
- 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())); |
- } |
- } |
- } |
- } |
- |
// Have Chrome plugins write their data to the profile directory. |
GetInstance()->SetChromePluginDataDir(profile->GetPath()); |
} |