Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3802)

Unified Diff: chrome/browser/gtk/options/geolocation_content_exceptions_window.cc

Issue 1539021: Geolocation exceptions window, Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/gtk/options/geolocation_content_exceptions_window.cc
===================================================================
--- chrome/browser/gtk/options/geolocation_content_exceptions_window.cc (revision 43621)
+++ chrome/browser/gtk/options/geolocation_content_exceptions_window.cc (working copy)
@@ -143,37 +143,24 @@
int row_count = gtk_tree_model_iter_n_children(
GTK_TREE_MODEL(list_store_), NULL);
- gtk_widget_set_sensitive(remove_button_, CountSelectedRemovable() >= 1);
+ GeolocationContentSettingsTableModel::Rows rows;
+ GetSelectedRows(&rows);
+ gtk_widget_set_sensitive(remove_button_, model_->CanRemoveExceptions(rows));
gtk_widget_set_sensitive(remove_all_button_, row_count > 0);
}
-void GeolocationContentExceptionsWindow::GetSelectedRemovableIndicies(
- std::set<int>* indicies) {
- gtk_tree::GetSelectedIndicies(treeview_selection_, indicies);
-
- for (std::set<int>::iterator i = indicies->begin(); i != indicies->end(); ) {
- std::set<int>::iterator prev = i;
- ++i;
- if (!model_->CanRemoveException(*prev))
- indicies->erase(prev);
- }
-}
-
-int GeolocationContentExceptionsWindow::CountSelectedRemovable() {
+void GeolocationContentExceptionsWindow::GetSelectedRows(
+ GeolocationContentSettingsTableModel::Rows* rows) {
std::set<int> indicies;
- GetSelectedRemovableIndicies(&indicies);
- return indicies.size();
+ gtk_tree::GetSelectedIndicies(treeview_selection_, &indicies);
+ for (std::set<int>::iterator i = indicies.begin(); i != indicies.end(); ++i)
+ rows->insert(*i);
}
void GeolocationContentExceptionsWindow::Remove(GtkWidget* widget) {
- std::set<int> indicies;
- GetSelectedRemovableIndicies(&indicies);
-
- for (std::set<int>::reverse_iterator i = indicies.rbegin();
- i != indicies.rend(); ++i) {
- model_->RemoveException(*i);
- }
-
+ GeolocationContentSettingsTableModel::Rows rows;
+ GetSelectedRows(&rows);
+ model_->RemoveExceptions(rows);
UpdateButtonState();
}

Powered by Google App Engine
This is Rietveld 408576698