Chromium Code Reviews

Unified Diff: chrome/browser/plugin_updater.cc

Issue 5516004: Clean up PluginGroup and related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chrome/browser/plugin_updater.cc
diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc
index 8e8227c094803930cd35f317039841e69609cf60..1b25074263f4cc7d36ec9f485ee1cbd83f186c42 100644
--- a/chrome/browser/plugin_updater.cc
+++ b/chrome/browser/plugin_updater.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/plugin_updater.h"
+#include <set>
#include <string>
-#include <vector>
#include "base/command_line.h"
#include "base/message_loop.h"
@@ -45,16 +45,13 @@ DictionaryValue* PluginUpdater::CreatePluginFileSummary(
// static
ListValue* PluginUpdater::GetPluginGroupsData() {
- NPAPI::PluginList::PluginMap plugin_groups;
- NPAPI::PluginList::Singleton()->GetPluginGroups(true, &plugin_groups);
+ std::vector<PluginGroup> plugin_groups(
+ NPAPI::PluginList::Singleton()->GetPluginGroups(true));
// Construct DictionaryValues to return to the UI
ListValue* plugin_groups_data = new ListValue();
- for (NPAPI::PluginList::PluginMap::const_iterator it =
- plugin_groups.begin();
- it != plugin_groups.end();
- ++it) {
- plugin_groups_data->Append(it->second->GetDataForUI());
+ for (size_t i = 0; i < plugin_groups.size(); ++i) {
+ plugin_groups_data->Append(plugin_groups[i].GetDataForUI());
}
return plugin_groups_data;
}
@@ -244,8 +241,8 @@ void PluginUpdater::GetPreferencesDataOnFileThread(void* profile) {
std::vector<WebPluginInfo> plugins;
NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins);
- NPAPI::PluginList::PluginMap groups;
- NPAPI::PluginList::Singleton()->GetPluginGroups(false, &groups);
+ std::vector<PluginGroup> groups(
+ NPAPI::PluginList::Singleton()->GetPluginGroups(false));
BrowserThread::PostTask(
BrowserThread::UI,
@@ -258,7 +255,7 @@ void PluginUpdater::GetPreferencesDataOnFileThread(void* profile) {
void PluginUpdater::OnUpdatePreferences(
Profile* profile,
const std::vector<WebPluginInfo>& plugins,
- const NPAPI::PluginList::PluginMap& groups) {
+ const std::vector<PluginGroup>& groups) {
ListValue* plugins_list = profile->GetPrefs()->GetMutableList(
prefs::kPluginsPluginsList);
plugins_list->Clear();
@@ -276,13 +273,12 @@ void PluginUpdater::OnUpdatePreferences(
}
// Add the groups as well.
- for (NPAPI::PluginList::PluginMap::const_iterator it = groups.begin();
- it != groups.end(); ++it) {
+ for (size_t i = 0; i < groups.size(); ++i) {
// Don't save preferences for vulnerable pugins.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableOutdatedPlugins) ||
- !it->second->IsVulnerable()) {
- plugins_list->Append(it->second->GetSummary());
+ !groups[i].IsVulnerable()) {
+ plugins_list->Append(groups[i].GetSummary());
}
}
}

Powered by Google App Engine