OLD | NEW |
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_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ |
6 #define CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/remove_rows_table_model.h" | 14 #include "chrome/browser/remove_rows_table_model.h" |
15 #include "chrome/common/notification_observer.h" | 15 #include "chrome/common/notification_observer.h" |
16 #include "webkit/glue/plugins/plugin_list.h" | 16 #include "webkit/glue/plugins/plugin_list.h" |
17 | 17 |
18 namespace plugin_test_internal { | |
19 class PluginExceptionsTableModelTest; | |
20 } | |
21 struct WebPluginInfo; | 18 struct WebPluginInfo; |
22 | 19 |
23 class PluginExceptionsTableModel : public RemoveRowsTableModel, | 20 class PluginExceptionsTableModel : public RemoveRowsTableModel, |
24 public NotificationObserver { | 21 public NotificationObserver { |
25 public: | 22 public: |
26 PluginExceptionsTableModel(HostContentSettingsMap* content_settings_map, | 23 PluginExceptionsTableModel(HostContentSettingsMap* content_settings_map, |
27 HostContentSettingsMap* otr_content_settings_map); | 24 HostContentSettingsMap* otr_content_settings_map); |
28 virtual ~PluginExceptionsTableModel(); | 25 virtual ~PluginExceptionsTableModel(); |
29 | 26 |
30 // Load plugin exceptions from the HostContentSettingsMaps. You should call | 27 // Load plugin exceptions from the HostContentSettingsMaps. You should call |
(...skipping 16 matching lines...) Expand all Loading... |
47 // NotificationObserver methods: | 44 // NotificationObserver methods: |
48 virtual void Observe(NotificationType type, | 45 virtual void Observe(NotificationType type, |
49 const NotificationSource& source, | 46 const NotificationSource& source, |
50 const NotificationDetails& details); | 47 const NotificationDetails& details); |
51 | 48 |
52 protected: | 49 protected: |
53 // Subclasses can override this method for testing. | 50 // Subclasses can override this method for testing. |
54 virtual void GetPlugins(std::vector<PluginGroup>* plugin_groups); | 51 virtual void GetPlugins(std::vector<PluginGroup>* plugin_groups); |
55 | 52 |
56 private: | 53 private: |
57 friend class plugin_test_internal::PluginExceptionsTableModelTest; | 54 friend class PluginExceptionsTableModelTest; |
58 | 55 |
59 struct SettingsEntry { | 56 struct SettingsEntry { |
60 ContentSettingsPattern pattern; | 57 ContentSettingsPattern pattern; |
61 int plugin_id; | 58 int plugin_id; |
62 ContentSetting setting; | 59 ContentSetting setting; |
63 bool is_otr; | 60 bool is_otr; |
64 }; | 61 }; |
65 | 62 |
66 void ClearSettings(); | 63 void ClearSettings(); |
67 void ReloadSettings(); | 64 void ReloadSettings(); |
68 | 65 |
69 scoped_refptr<HostContentSettingsMap> map_; | 66 scoped_refptr<HostContentSettingsMap> map_; |
70 scoped_refptr<HostContentSettingsMap> otr_map_; | 67 scoped_refptr<HostContentSettingsMap> otr_map_; |
71 | 68 |
72 std::deque<SettingsEntry> settings_; | 69 std::deque<SettingsEntry> settings_; |
73 std::deque<int> row_counts_; | 70 std::deque<int> row_counts_; |
74 std::deque<std::string> resources_; | 71 std::deque<std::string> resources_; |
75 TableModel::Groups groups_; | 72 TableModel::Groups groups_; |
76 | 73 |
77 NotificationRegistrar registrar_; | 74 NotificationRegistrar registrar_; |
78 bool updates_disabled_; | 75 bool updates_disabled_; |
79 TableModelObserver* observer_; | 76 TableModelObserver* observer_; |
80 | 77 |
81 DISALLOW_COPY_AND_ASSIGN(PluginExceptionsTableModel); | 78 DISALLOW_COPY_AND_ASSIGN(PluginExceptionsTableModel); |
82 }; | 79 }; |
83 | 80 |
84 #endif // CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ | 81 #endif // CHROME_BROWSER_PLUGIN_EXCEPTIONS_TABLE_MODEL_H_ |
OLD | NEW |