OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/plugin_exceptions_table_model.h" | 5 #include "chrome/browser/plugin_exceptions_table_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 void PluginExceptionsTableModel::ClearSettings() { | 125 void PluginExceptionsTableModel::ClearSettings() { |
126 settings_.clear(); | 126 settings_.clear(); |
127 groups_.clear(); | 127 groups_.clear(); |
128 row_counts_.clear(); | 128 row_counts_.clear(); |
129 resources_.clear(); | 129 resources_.clear(); |
130 } | 130 } |
131 | 131 |
132 void PluginExceptionsTableModel::GetPlugins( | 132 void PluginExceptionsTableModel::GetPlugins( |
133 NPAPI::PluginList::PluginMap* plugins) { | 133 std::vector<PluginGroup>* plugin_groups) { |
134 NPAPI::PluginList::Singleton()->GetPluginGroups(false, plugins); | 134 NPAPI::PluginList::Singleton()->GetPluginGroups(false, plugin_groups); |
135 } | 135 } |
136 | 136 |
137 void PluginExceptionsTableModel::LoadSettings() { | 137 void PluginExceptionsTableModel::LoadSettings() { |
138 int group_id = 0; | 138 int group_id = 0; |
139 NPAPI::PluginList::PluginMap plugins; | 139 std::vector<PluginGroup> plugins; |
140 GetPlugins(&plugins); | 140 GetPlugins(&plugins); |
141 for (NPAPI::PluginList::PluginMap::iterator it = plugins.begin(); | 141 for (size_t i = 0; i < plugins.size(); ++i) { |
142 it != plugins.end(); ++it) { | 142 std::string plugin = plugins[i].identifier(); |
143 std::string plugin = it->first; | |
144 HostContentSettingsMap::SettingsForOneType settings; | 143 HostContentSettingsMap::SettingsForOneType settings; |
145 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, | 144 map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, |
146 plugin, | 145 plugin, |
147 &settings); | 146 &settings); |
148 HostContentSettingsMap::SettingsForOneType otr_settings; | 147 HostContentSettingsMap::SettingsForOneType otr_settings; |
149 if (otr_map_) { | 148 if (otr_map_) { |
150 otr_map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, | 149 otr_map_->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, |
151 plugin, | 150 plugin, |
152 &otr_settings); | 151 &otr_settings); |
153 } | 152 } |
154 std::wstring title = UTF16ToWide(it->second->GetGroupName()); | 153 std::wstring title = UTF16ToWide(plugins[i].GetGroupName()); |
155 for (HostContentSettingsMap::SettingsForOneType::iterator setting_it = | 154 for (HostContentSettingsMap::SettingsForOneType::iterator setting_it = |
156 settings.begin(); setting_it != settings.end(); ++setting_it) { | 155 settings.begin(); setting_it != settings.end(); ++setting_it) { |
157 SettingsEntry entry = { | 156 SettingsEntry entry = { |
158 setting_it->first, | 157 setting_it->first, |
159 group_id, | 158 group_id, |
160 setting_it->second, | 159 setting_it->second, |
161 false | 160 false |
162 }; | 161 }; |
163 settings_.push_back(entry); | 162 settings_.push_back(entry); |
164 } | 163 } |
(...skipping 19 matching lines...) Expand all Loading... |
184 } | 183 } |
185 | 184 |
186 void PluginExceptionsTableModel::ReloadSettings() { | 185 void PluginExceptionsTableModel::ReloadSettings() { |
187 ClearSettings(); | 186 ClearSettings(); |
188 LoadSettings(); | 187 LoadSettings(); |
189 | 188 |
190 if (observer_) | 189 if (observer_) |
191 observer_->OnModelChanged(); | 190 observer_->OnModelChanged(); |
192 } | 191 } |
193 | 192 |
OLD | NEW |