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

Side by Side Diff: chrome/browser/content_exceptions_table_model.h

Issue 3017011: Make content settings map updates live.
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_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ 5 #ifndef CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_
6 #define CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ 6 #define CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "app/table_model.h" 10 #include "app/table_model.h"
11 #include "chrome/common/content_settings.h" 11 #include "chrome/common/content_settings.h"
12 #include "chrome/common/content_settings_types.h" 12 #include "chrome/common/content_settings_types.h"
13 #include "chrome/common/notification_registrar.h"
14 #include "chrome/common/notification_service.h"
13 #include "chrome/browser/host_content_settings_map.h" 15 #include "chrome/browser/host_content_settings_map.h"
14 16
15 class ContentExceptionsTableModel : public TableModel { 17 class ContentExceptionsTableModel : public TableModel,
18 public NotificationObserver {
16 public: 19 public:
17 ContentExceptionsTableModel(HostContentSettingsMap* map, 20 ContentExceptionsTableModel(HostContentSettingsMap* map,
18 ContentSettingsType content_type); 21 ContentSettingsType content_type);
19 22
20 HostContentSettingsMap* map() const { return map_; } 23 HostContentSettingsMap* map() const { return map_; }
21 ContentSettingsType content_type() const { return content_type_; } 24 ContentSettingsType content_type() const { return content_type_; }
22 25
23 const HostContentSettingsMap::HostSettingPair& entry_at(int index) { 26 const HostContentSettingsMap::HostSettingPair& entry_at(int index) {
24 return entries_[index]; 27 return entries_[index];
25 } 28 }
26 29
27 // Adds a new exception on the map and table model. 30 // Adds a new exception on the map and table model.
28 void AddException(const std::string& host, ContentSetting setting); 31 void AddException(const std::string& host, ContentSetting setting);
29 32
30 // Removes the exception at the specified index from both the map and model. 33 // Removes the exception at the specified index from both the map and model.
31 void RemoveException(int row); 34 void RemoveException(int row);
32 35
33 // Removes all the exceptions from both the map and model. 36 // Removes all the exceptions from both the map and model.
34 void RemoveAll(); 37 void RemoveAll();
35 38
36 // Returns the index of the specified exception given a host, or -1 if there 39 // Returns the index of the specified exception given a host, or -1 if there
37 // is no exception for the specified host. 40 // is no exception for the specified host.
38 int IndexOfExceptionByHost(const std::string& host); 41 int IndexOfExceptionByHost(const std::string& host);
39 42
40 // TableModel overrides: 43 // TableModel overrides:
41 virtual int RowCount(); 44 virtual int RowCount();
42 virtual std::wstring GetText(int row, int column_id); 45 virtual std::wstring GetText(int row, int column_id);
43 virtual void SetObserver(TableModelObserver* observer); 46 virtual void SetObserver(TableModelObserver* observer);
44 47
48 // NotificationObserver overrides:
49 virtual void Observe(NotificationType type,
50 const NotificationSource& source,
51 const NotificationDetails& details);
45 private: 52 private:
46 HostContentSettingsMap* map_; 53 HostContentSettingsMap* map_;
47 ContentSettingsType content_type_; 54 ContentSettingsType content_type_;
48 HostContentSettingsMap::SettingsForOneType entries_; 55 HostContentSettingsMap::SettingsForOneType entries_;
49 TableModelObserver* observer_; 56 TableModelObserver* observer_;
57 NotificationRegistrar registrar_;
50 58
51 DISALLOW_COPY_AND_ASSIGN(ContentExceptionsTableModel); 59 DISALLOW_COPY_AND_ASSIGN(ContentExceptionsTableModel);
52 }; 60 };
53 61
54 #endif // CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ 62 #endif // CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/content_settings_dialog_controller.mm ('k') | chrome/browser/content_exceptions_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698