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

Side by Side Diff: chrome/browser/geolocation/geolocation_exceptions_table_model.h

Issue 2838037: Introduce RemoveRowTableModel interface, let GeolocationExceptionsTableModel derive from it. (Closed)
Patch Set: '' Created 10 years, 5 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "app/table_model.h"
12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 11 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
12 #include "chrome/browser/remove_rows_table_model.h"
13 #include "chrome/common/content_settings.h" 13 #include "chrome/common/content_settings.h"
14 #include "chrome/common/content_settings_types.h" 14 #include "chrome/common/content_settings_types.h"
15 15
16 class GeolocationExceptionsTableModel : public TableModel { 16 class GeolocationExceptionsTableModel : public RemoveRowsTableModel {
17 public: 17 public:
18 typedef std::set<size_t> Rows;
19
20 explicit GeolocationExceptionsTableModel( 18 explicit GeolocationExceptionsTableModel(
21 GeolocationContentSettingsMap* map); 19 GeolocationContentSettingsMap* map);
22 20
21 // RemoveRowsTableModel overrides:
22
23 // Return whether the given set of rows can be removed. A parent with setting 23 // Return whether the given set of rows can be removed. A parent with setting
24 // of CONTENT_SETTING_DEFAULT can't be removed unless all its children are 24 // of CONTENT_SETTING_DEFAULT can't be removed unless all its children are
25 // also being removed. 25 // also being removed.
26 bool CanRemoveExceptions(const Rows& rows) const; 26 virtual bool CanRemoveRows(const Rows& rows) const;
27 27
28 // Removes the exceptions at the specified indexes. If an exception is a 28 // Removes the exceptions at the specified indexes. If an exception is a
29 // parent, and it has children, the row in model will be updated to have 29 // parent, and it has children, the row in model will be updated to have
30 // CONTENT_SETTING_DEFAULT. If it is the only child of a 30 // CONTENT_SETTING_DEFAULT. If it is the only child of a
31 // CONTENT_SETTING_DEFAULT parent, the parent will be removed from the model 31 // CONTENT_SETTING_DEFAULT parent, the parent will be removed from the model
32 // too. 32 // too.
33 void RemoveExceptions(const Rows& rows); 33 virtual void RemoveRows(const Rows& rows);
34 34
35 // Removes all the exceptions from both the map and model. 35 // Removes all the exceptions from both the map and model.
36 void RemoveAll(); 36 virtual void RemoveAll();
37 37
38 // TableModel overrides: 38 // TableModel overrides:
39 virtual int RowCount(); 39 virtual int RowCount();
40 virtual std::wstring GetText(int row, int column_id); 40 virtual std::wstring GetText(int row, int column_id);
41 virtual void SetObserver(TableModelObserver* observer); 41 virtual void SetObserver(TableModelObserver* observer);
42 virtual int CompareValues(int row1, int row2, int column_id); 42 virtual int CompareValues(int row1, int row2, int column_id);
43 43
44 private: 44 private:
45 struct Entry { 45 struct Entry {
46 Entry(const GURL& origin, 46 Entry(const GURL& origin,
(...skipping 13 matching lines...) Expand all
60 60
61 typedef std::vector<Entry> EntriesVector; 61 typedef std::vector<Entry> EntriesVector;
62 EntriesVector entries_; 62 EntriesVector entries_;
63 63
64 TableModelObserver* observer_; 64 TableModelObserver* observer_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(GeolocationExceptionsTableModel); 66 DISALLOW_COPY_AND_ASSIGN(GeolocationExceptionsTableModel);
67 }; 67 };
68 68
69 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_ 69 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_EXCEPTIONS_TABLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698