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

Unified Diff: chrome/browser/cocoa/geolocation_exceptions_window_controller.mm

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/cocoa/geolocation_exceptions_window_controller.mm
===================================================================
--- chrome/browser/cocoa/geolocation_exceptions_window_controller.mm (revision 43621)
+++ chrome/browser/cocoa/geolocation_exceptions_window_controller.mm (working copy)
@@ -18,8 +18,7 @@
@interface GeolocationExceptionsWindowController (Private)
- (id)initWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap;
-- (void)selectedRemovableIndices:(std::set<int>*)indices;
-- (int)countSelectedRemovable;
+- (void)selectedRows:(GeolocationContentSettingsTableModel::Rows*)rows;
- (void)adjustEditingButtons;
- (void)modelDidChange;
@end
@@ -135,13 +134,9 @@
}
- (IBAction)removeException:(id)sender {
- std::set<int> indices;
- [self selectedRemovableIndices:&indices];
-
- for (std::set<int>::reverse_iterator i = indices.rbegin();
- i != indices.rend(); ++i) {
- model_->RemoveException(*i);
- }
+ GeolocationContentSettingsTableModel::Rows rows;
+ [self selectedRows:&rows];
+ model_->RemoveExceptions(rows);
}
- (IBAction)removeAllExceptions:(id)sender {
@@ -180,27 +175,20 @@
// Private --------------------------------------------------------------------
-// Returns the indices of all selected rows that are removable.
-- (void)selectedRemovableIndices:(std::set<int>*)indices {
+// Returns the selected rows.
+- (void)selectedRows:(GeolocationContentSettingsTableModel::Rows*)rows {
NSIndexSet* selection = [tableView_ selectedRowIndexes];
for (NSUInteger index = [selection lastIndex]; index != NSNotFound;
- index = [selection indexLessThanIndex:index]) {
- if (model_->CanRemoveException(index))
- indices->insert(index);
- }
+ index = [selection indexLessThanIndex:index])
+ rows->insert(index);
}
-// Returns how many of the selected rows are removable.
-- (int)countSelectedRemovable {
- std::set<int> indices;
- [self selectedRemovableIndices:&indices];
- return indices.size();
-}
-
// This method appropriately sets the enabled states on the table's editing
// buttons.
- (void)adjustEditingButtons {
- [removeButton_ setEnabled:([self countSelectedRemovable] > 0)];
+ GeolocationContentSettingsTableModel::Rows rows;
+ [self selectedRows:&rows];
+ [removeButton_ setEnabled:model_->CanRemoveExceptions(rows)];
[removeAllButton_ setEnabled:([tableView_ numberOfRows] > 0)];
}
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | chrome/browser/geolocation/geolocation_content_settings_table_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698