diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 12:36:39 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 12:36:39 +0000 |
commit | 476c6d05c1abc015ff3b479f8f2132a0fc604b9e (patch) | |
tree | 6d1358e495366f708539c70f91699470cac99fcb /chrome/browser | |
parent | 0d5b9e252bcfd5ac4dbf0141bec384381fd18151 (diff) | |
download | chromium_src-476c6d05c1abc015ff3b479f8f2132a0fc604b9e.zip chromium_src-476c6d05c1abc015ff3b479f8f2132a0fc604b9e.tar.gz chromium_src-476c6d05c1abc015ff3b479f8f2132a0fc604b9e.tar.bz2 |
Renames GeolocationContentSettingsTableModel to GeolocationExceptionsTableModel
TEST=Compiles
BUG=40286
Review URL: http://codereview.chromium.org/2069016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cocoa/geolocation_exceptions_window_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/geolocation_exceptions_window_controller.mm | 12 | ||||
-rw-r--r-- | chrome/browser/geolocation/geolocation_exceptions_table_model.cc (renamed from chrome/browser/geolocation/geolocation_content_settings_table_model.cc) | 22 | ||||
-rw-r--r-- | chrome/browser/geolocation/geolocation_exceptions_table_model.h (renamed from chrome/browser/geolocation/geolocation_content_settings_table_model.h) | 12 | ||||
-rw-r--r-- | chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc (renamed from chrome/browser/geolocation/geolocation_content_settings_table_model_unittest.cc) | 24 | ||||
-rw-r--r-- | chrome/browser/gtk/options/geolocation_content_exceptions_window.cc | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/options/geolocation_content_exceptions_window.h | 6 | ||||
-rw-r--r-- | chrome/browser/views/options/geolocation_exceptions_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/options/geolocation_exceptions_view.h | 8 |
9 files changed, 50 insertions, 50 deletions
diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.h b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h index f93b9af..f2debe0 100644 --- a/chrome/browser/cocoa/geolocation_exceptions_window_controller.h +++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h @@ -8,7 +8,7 @@ #include "base/scoped_ptr.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" -class GeolocationContentSettingsTableModel; +class GeolocationExceptionsTableModel; class GeolocationObserverBridge; // Controller for the geolocation exception dialog. @@ -23,7 +23,7 @@ class GeolocationObserverBridge; IBOutlet NSButton* doneButton_; GeolocationContentSettingsMap* settingsMap_; // weak - scoped_ptr<GeolocationContentSettingsTableModel> model_; + scoped_ptr<GeolocationExceptionsTableModel> model_; scoped_ptr<GeolocationObserverBridge> tableObserver_; } diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm index 7c7bee4..fbb69d3 100644 --- a/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm +++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm @@ -12,13 +12,13 @@ #import "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" -#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" +#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" #include "grit/generated_resources.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" @interface GeolocationExceptionsWindowController (Private) - (id)initWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap; -- (void)selectedRows:(GeolocationContentSettingsTableModel::Rows*)rows; +- (void)selectedRows:(GeolocationExceptionsTableModel::Rows*)rows; - (void)adjustEditingButtons; - (void)modelDidChange; @end @@ -71,7 +71,7 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; ofType:@"nib"]; if ((self = [super initWithWindowNibPath:nibpath owner:self])) { settingsMap_ = settingsMap; - model_.reset(new GeolocationContentSettingsTableModel(settingsMap_)); + model_.reset(new GeolocationExceptionsTableModel(settingsMap_)); tableObserver_.reset(new GeolocationObserverBridge(self)); model_->SetObserver(tableObserver_.get()); @@ -154,7 +154,7 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; } - (IBAction)removeException:(id)sender { - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; [self selectedRows:&rows]; model_->RemoveExceptions(rows); } @@ -196,7 +196,7 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; // Private -------------------------------------------------------------------- // Returns the selected rows. -- (void)selectedRows:(GeolocationContentSettingsTableModel::Rows*)rows { +- (void)selectedRows:(GeolocationExceptionsTableModel::Rows*)rows { NSIndexSet* selection = [tableView_ selectedRowIndexes]; for (NSUInteger index = [selection lastIndex]; index != NSNotFound; index = [selection indexLessThanIndex:index]) @@ -206,7 +206,7 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; // This method appropriately sets the enabled states on the table's editing // buttons. - (void)adjustEditingButtons { - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; [self selectedRows:&rows]; [removeButton_ setEnabled:model_->CanRemoveExceptions(rows)]; [removeAllButton_ setEnabled:([tableView_ numberOfRows] > 0)]; diff --git a/chrome/browser/geolocation/geolocation_content_settings_table_model.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model.cc index 837c1d4..95d2e79 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_table_model.cc +++ b/chrome/browser/geolocation/geolocation_exceptions_table_model.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" +#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" #include "app/l10n_util.h" #include "app/l10n_util_collator.h" @@ -46,7 +46,7 @@ int CompareOrigins(const GURL& origin1, const GURL& origin2) { } } // namespace -GeolocationContentSettingsTableModel::GeolocationContentSettingsTableModel( +GeolocationExceptionsTableModel::GeolocationExceptionsTableModel( GeolocationContentSettingsMap* map) : map_(map), observer_(NULL) { @@ -57,7 +57,7 @@ GeolocationContentSettingsTableModel::GeolocationContentSettingsTableModel( AddEntriesForOrigin(i->first, i->second); } -bool GeolocationContentSettingsTableModel::CanRemoveExceptions( +bool GeolocationExceptionsTableModel::CanRemoveExceptions( const Rows& rows) const { for (Rows::const_iterator i(rows.begin()); i != rows.end(); ++i) { const Entry& entry = entries_[*i]; @@ -73,7 +73,7 @@ bool GeolocationContentSettingsTableModel::CanRemoveExceptions( return !rows.empty(); } -void GeolocationContentSettingsTableModel::RemoveExceptions(const Rows& rows) { +void GeolocationExceptionsTableModel::RemoveExceptions(const Rows& rows) { for (Rows::const_reverse_iterator i(rows.rbegin()); i != rows.rend(); ++i) { size_t row = *i; Entry* entry = &entries_[row]; @@ -109,7 +109,7 @@ void GeolocationContentSettingsTableModel::RemoveExceptions(const Rows& rows) { } } -void GeolocationContentSettingsTableModel::RemoveAll() { +void GeolocationExceptionsTableModel::RemoveAll() { int old_row_count = RowCount(); entries_.clear(); map_->ResetToDefault(); @@ -117,11 +117,11 @@ void GeolocationContentSettingsTableModel::RemoveAll() { observer_->OnItemsRemoved(0, old_row_count); } -int GeolocationContentSettingsTableModel::RowCount() { +int GeolocationExceptionsTableModel::RowCount() { return entries_.size(); } -std::wstring GeolocationContentSettingsTableModel::GetText(int row, +std::wstring GeolocationExceptionsTableModel::GetText(int row, int column_id) { const Entry& entry = entries_[row]; if (column_id == IDS_EXCEPTIONS_HOSTNAME_HEADER) { @@ -164,12 +164,12 @@ std::wstring GeolocationContentSettingsTableModel::GetText(int row, return std::wstring(); } -void GeolocationContentSettingsTableModel::SetObserver( +void GeolocationExceptionsTableModel::SetObserver( TableModelObserver* observer) { observer_ = observer; } -int GeolocationContentSettingsTableModel::CompareValues(int row1, +int GeolocationExceptionsTableModel::CompareValues(int row1, int row2, int column_id) { DCHECK(row1 >= 0 && row1 < RowCount() && @@ -218,7 +218,7 @@ int GeolocationContentSettingsTableModel::CompareValues(int row1, return origin_comparison; } -void GeolocationContentSettingsTableModel::AddEntriesForOrigin( +void GeolocationExceptionsTableModel::AddEntriesForOrigin( const GURL& origin, const GeolocationContentSettingsMap::OneOriginSettings& settings) { GeolocationContentSettingsMap::OneOriginSettings::const_iterator parent = @@ -240,7 +240,7 @@ void GeolocationContentSettingsTableModel::AddEntriesForOrigin( } // static -GeolocationContentSettingsTableModel::Entry::Entry( +GeolocationExceptionsTableModel::Entry::Entry( const GURL& in_origin, const GURL& in_embedding_origin, ContentSetting in_setting) : origin(in_origin), diff --git a/chrome/browser/geolocation/geolocation_content_settings_table_model.h b/chrome/browser/geolocation/geolocation_exceptions_table_model.h index 4d42407..6328166 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_table_model.h +++ b/chrome/browser/geolocation/geolocation_exceptions_table_model.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONTENT_SETTINGS_TABLE_MODEL_H_ -#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONTENT_SETTINGS_TABLE_MODEL_H_ +#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ +#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ #include <set> #include <vector> @@ -13,11 +13,11 @@ #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_types.h" -class GeolocationContentSettingsTableModel : public TableModel { +class GeolocationExceptionsTableModel : public TableModel { public: typedef std::set<size_t> Rows; - explicit GeolocationContentSettingsTableModel( + explicit GeolocationExceptionsTableModel( GeolocationContentSettingsMap* map); // Return whether the given set of rows can be removed. A parent with setting @@ -63,7 +63,7 @@ class GeolocationContentSettingsTableModel : public TableModel { TableModelObserver* observer_; - DISALLOW_COPY_AND_ASSIGN(GeolocationContentSettingsTableModel); + DISALLOW_COPY_AND_ASSIGN(GeolocationExceptionsTableModel); }; -#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONTENT_SETTINGS_TABLE_MODEL_H_ +#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ diff --git a/chrome/browser/geolocation/geolocation_content_settings_table_model_unittest.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc index 98b8789..62b65c0 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_table_model_unittest.cc +++ b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" +#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/test/testing_profile.h" @@ -18,15 +18,15 @@ const GURL kUrl1("http://www.example1.com"); const GURL kUrl2("http://www.example2.com"); } // namespace -class GeolocationContentSettingsTableModelTest +class GeolocationExceptionsTableModelTest : public RenderViewHostTestHarness { public: - GeolocationContentSettingsTableModelTest() + GeolocationExceptionsTableModelTest() : ui_thread_(ChromeThread::UI, MessageLoop::current()) { } - virtual ~GeolocationContentSettingsTableModelTest() { + virtual ~GeolocationExceptionsTableModelTest() { } virtual void SetUp() { @@ -40,7 +40,7 @@ class GeolocationContentSettingsTableModelTest } virtual void ResetModel() { - model_.reset(new GeolocationContentSettingsTableModel( + model_.reset(new GeolocationExceptionsTableModel( profile()->GetGeolocationContentSettingsMap())); } @@ -56,10 +56,10 @@ class GeolocationContentSettingsTableModelTest protected: ChromeThread ui_thread_; - scoped_ptr<GeolocationContentSettingsTableModel> model_; + scoped_ptr<GeolocationExceptionsTableModel> model_; }; -TEST_F(GeolocationContentSettingsTableModelTest, CanRemoveException) { +TEST_F(GeolocationExceptionsTableModelTest, CanRemoveException) { EXPECT_EQ(0, model_->RowCount()); scoped_refptr<GeolocationContentSettingsMap> map = @@ -69,7 +69,7 @@ TEST_F(GeolocationContentSettingsTableModelTest, CanRemoveException) { map->SetContentSetting(kUrl0, kUrl0, CONTENT_SETTING_ALLOW); ResetModel(); EXPECT_EQ(1, model_->RowCount()); - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; rows.insert(0U); EXPECT_TRUE(model_->CanRemoveExceptions(rows)); @@ -89,13 +89,13 @@ TEST_F(GeolocationContentSettingsTableModelTest, CanRemoveException) { EXPECT_TRUE(model_->CanRemoveExceptions(rows)); } -TEST_F(GeolocationContentSettingsTableModelTest, RemoveExceptions) { +TEST_F(GeolocationExceptionsTableModelTest, RemoveExceptions) { CreateAllowedSamples(); scoped_refptr<GeolocationContentSettingsMap> map = profile()->GetGeolocationContentSettingsMap(); // Test removing parent exception. - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; rows.insert(0U); model_->RemoveExceptions(rows); EXPECT_EQ(CONTENT_SETTING_ASK, map->GetContentSetting(kUrl0, kUrl0)); @@ -116,7 +116,7 @@ TEST_F(GeolocationContentSettingsTableModelTest, RemoveExceptions) { EXPECT_EQ(CONTENT_SETTING_ASK, map->GetContentSetting(kUrl0, kUrl2)); } -TEST_F(GeolocationContentSettingsTableModelTest, RemoveAll) { +TEST_F(GeolocationExceptionsTableModelTest, RemoveAll) { CreateAllowedSamples(); scoped_refptr<GeolocationContentSettingsMap> map = profile()->GetGeolocationContentSettingsMap(); @@ -128,7 +128,7 @@ TEST_F(GeolocationContentSettingsTableModelTest, RemoveAll) { EXPECT_EQ(0, model_->RowCount()); } -TEST_F(GeolocationContentSettingsTableModelTest, GetText) { +TEST_F(GeolocationExceptionsTableModelTest, GetText) { CreateAllowedSamples(); // Ensure the parent doesn't have any indentation. diff --git a/chrome/browser/gtk/options/geolocation_content_exceptions_window.cc b/chrome/browser/gtk/options/geolocation_content_exceptions_window.cc index 2b46fd9..79cfe20 100644 --- a/chrome/browser/gtk/options/geolocation_content_exceptions_window.cc +++ b/chrome/browser/gtk/options/geolocation_content_exceptions_window.cc @@ -63,7 +63,7 @@ GeolocationContentExceptionsWindow::GeolocationContentExceptionsWindow( G_CALLBACK(OnTreeSelectionChangedThunk), this); // Bind |list_store_| to our C++ model. - model_.reset(new GeolocationContentSettingsTableModel(map)); + model_.reset(new GeolocationExceptionsTableModel(map)); model_adapter_.reset(new gtk_tree::TableAdapter(this, list_store_, model_.get())); // Force a reload of everything to copy data into |list_store_|. @@ -139,14 +139,14 @@ void GeolocationContentExceptionsWindow::UpdateButtonState() { int row_count = gtk_tree_model_iter_n_children( GTK_TREE_MODEL(list_store_), NULL); - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::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::GetSelectedRows( - GeolocationContentSettingsTableModel::Rows* rows) { + GeolocationExceptionsTableModel::Rows* rows) { std::set<int> indices; gtk_tree::GetSelectedIndices(treeview_selection_, &indices); for (std::set<int>::iterator i = indices.begin(); i != indices.end(); ++i) @@ -154,7 +154,7 @@ void GeolocationContentExceptionsWindow::GetSelectedRows( } void GeolocationContentExceptionsWindow::Remove(GtkWidget* widget) { - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; GetSelectedRows(&rows); model_->RemoveExceptions(rows); UpdateButtonState(); diff --git a/chrome/browser/gtk/options/geolocation_content_exceptions_window.h b/chrome/browser/gtk/options/geolocation_content_exceptions_window.h index 932184c..320ce2a 100644 --- a/chrome/browser/gtk/options/geolocation_content_exceptions_window.h +++ b/chrome/browser/gtk/options/geolocation_content_exceptions_window.h @@ -11,7 +11,7 @@ #include "app/gtk_signal.h" #include "base/scoped_ptr.h" -#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" +#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" #include "chrome/browser/gtk/gtk_tree.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_types.h" @@ -41,7 +41,7 @@ class GeolocationContentExceptionsWindow // Updates which buttons are enabled. void UpdateButtonState(); - void GetSelectedRows(GeolocationContentSettingsTableModel::Rows* rows); + void GetSelectedRows(GeolocationExceptionsTableModel::Rows* rows); // Callbacks for the buttons. CHROMEGTK_CALLBACK_0(GeolocationContentExceptionsWindow, void, Remove); @@ -57,7 +57,7 @@ class GeolocationContentExceptionsWindow // The C++, views-ish, cross-platform model class that actually contains the // gold standard data. - scoped_ptr<GeolocationContentSettingsTableModel> model_; + scoped_ptr<GeolocationExceptionsTableModel> model_; // The adapter that ferries data back and forth between |model_| and // |list_store_| whenever either of them change. diff --git a/chrome/browser/views/options/geolocation_exceptions_view.cc b/chrome/browser/views/options/geolocation_exceptions_view.cc index 336e9bb..869fcbb 100644 --- a/chrome/browser/views/options/geolocation_exceptions_view.cc +++ b/chrome/browser/views/options/geolocation_exceptions_view.cc @@ -155,9 +155,9 @@ void GeolocationExceptionsView::Init() { UpdateButtonState(); } -GeolocationContentSettingsTableModel::Rows +GeolocationExceptionsTableModel::Rows GeolocationExceptionsView::GetSelectedRows() const { - GeolocationContentSettingsTableModel::Rows rows; + GeolocationExceptionsTableModel::Rows rows; for (views::TableView::iterator i(table_->SelectionBegin()); i != table_->SelectionEnd(); ++i) rows.insert(*i); diff --git a/chrome/browser/views/options/geolocation_exceptions_view.h b/chrome/browser/views/options/geolocation_exceptions_view.h index 1a82956..417b9f3 100644 --- a/chrome/browser/views/options/geolocation_exceptions_view.h +++ b/chrome/browser/views/options/geolocation_exceptions_view.h @@ -7,7 +7,7 @@ #include <string> -#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" +#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" #include "chrome/common/content_settings.h" #include "views/controls/button/button.h" #include "views/controls/table/table_view_observer.h" @@ -22,7 +22,7 @@ class TableView; // GeolocationExceptionsView is responsible for showing the user the set of // site-specific geolocation permissions. The exceptions are shown in a table -// view by way of a GeolocationContentSettingsTableModel. The user can remove +// view by way of a GeolocationExceptionsTableModel. The user can remove // exceptions. // Use the ShowExceptionsWindow method to create and show a // GeolocationExceptionsView, which is deleted when the window closes. @@ -68,7 +68,7 @@ class GeolocationExceptionsView : public views::View, void UpdateButtonState(); // Returns the set of selected rows. - GeolocationContentSettingsTableModel::Rows GetSelectedRows() const; + GeolocationExceptionsTableModel::Rows GetSelectedRows() const; // Removes the selected item. void Remove(); @@ -77,7 +77,7 @@ class GeolocationExceptionsView : public views::View, void RemoveAll(); // The model displayed in the table. - GeolocationContentSettingsTableModel model_; + GeolocationExceptionsTableModel model_; views::TableView* table_; |