summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_exceptions_table_model.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 15:38:44 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 15:38:44 +0000
commit0cd07f946c353e33d0b9474d383ab06612e40bd8 (patch)
treec3b05021da46c9f489d5b359f53a3e3f36f02ae7 /chrome/browser/plugin_exceptions_table_model.cc
parente19f6b1bb2e8d09ae7471f10d56c834a250182c5 (diff)
downloadchromium_src-0cd07f946c353e33d0b9474d383ab06612e40bd8.zip
chromium_src-0cd07f946c353e33d0b9474d383ab06612e40bd8.tar.gz
chromium_src-0cd07f946c353e33d0b9474d383ab06612e40bd8.tar.bz2
[Mac] Add per-plugin exceptions to content settings.
Screenshot: http://www.dropmocks.com/mXMd I'm adding a subclass of NSArrayController, TableModelArrayController, that binds to a RemoveRowsTableModel that can use groups and displays them using group rows in an NSTableView. This cleans up SimpleContentExceptionsWindowController a lot, and the class could also be used for other table models that use groups (keyword editor and autofill). XIB changes: In SimpleContentExceptionsWindow.xib, bind table view to TableModelArrayController instead of using the dataSource outlet. Buttons call actions on TableModelArrayController, and table view delegate also points to it. BUG=39252 TEST=SimpleContentExceptionsWindowControllerTest.*:TableModelArrayControllerTest.*:PluginExceptionsTableModelTest.* Review URL: http://codereview.chromium.org/3327016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_exceptions_table_model.cc')
-rw-r--r--chrome/browser/plugin_exceptions_table_model.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/plugin_exceptions_table_model.cc b/chrome/browser/plugin_exceptions_table_model.cc
index f610432..18d76a6 100644
--- a/chrome/browser/plugin_exceptions_table_model.cc
+++ b/chrome/browser/plugin_exceptions_table_model.cc
@@ -34,6 +34,7 @@ void PluginExceptionsTableModel::RemoveRows(const Rows& rows) {
// Iterate in reverse over the rows to get the indexes right.
for (Rows::const_reverse_iterator it = rows.rbegin();
it != rows.rend(); ++it) {
+ DCHECK_LT(*it, settings_.size());
SettingsEntry& entry = settings_[*it];
HostContentSettingsMap* map = entry.is_otr ? otr_map_ : map_;
map->SetContentSetting(entry.pattern,
@@ -59,16 +60,14 @@ void PluginExceptionsTableModel::RemoveRows(const Rows& rows) {
}
void PluginExceptionsTableModel::RemoveAll() {
- int old_row_count = RowCount();
- {
- AutoReset<bool> tmp(&updates_disabled_, true);
- map_->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS);
- if (otr_map_)
- otr_map_->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS);
- }
+ AutoReset<bool> tmp(&updates_disabled_, true);
+ map_->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS);
+ if (otr_map_)
+ otr_map_->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS);
+
ClearSettings();
if (observer_)
- observer_->OnItemsRemoved(0, old_row_count);
+ observer_->OnModelChanged();
}
int PluginExceptionsTableModel::RowCount() {