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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "app/table_model.h" | 11 #include "app/table_model.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
13 #include "chrome/common/content_settings.h" | 14 #include "chrome/common/content_settings.h" |
14 #include "chrome/common/content_settings_types.h" | 15 #include "chrome/common/content_settings_types.h" |
15 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
16 | 17 |
17 class ContentExceptionsTableModel : public TableModel { | 18 class ContentExceptionsTableModel : public TableModel { |
18 public: | 19 public: |
19 ContentExceptionsTableModel(HostContentSettingsMap* map, | 20 ContentExceptionsTableModel(HostContentSettingsMap* map, |
20 HostContentSettingsMap* off_the_record_map, | 21 HostContentSettingsMap* off_the_record_map, |
21 ContentSettingsType content_type); | 22 ContentSettingsType content_type); |
(...skipping 24 matching lines...) Expand all Loading... |
46 | 47 |
47 // Removes all the exceptions from both the map and model. | 48 // Removes all the exceptions from both the map and model. |
48 void RemoveAll(); | 49 void RemoveAll(); |
49 | 50 |
50 // Returns the index of the specified exception given a host, or -1 if there | 51 // Returns the index of the specified exception given a host, or -1 if there |
51 // is no exception for the specified host. | 52 // is no exception for the specified host. |
52 int IndexOfExceptionByPattern(const ContentSettingsPattern& pattern, | 53 int IndexOfExceptionByPattern(const ContentSettingsPattern& pattern, |
53 bool is_off_the_record); | 54 bool is_off_the_record); |
54 | 55 |
55 // TableModel overrides: | 56 // TableModel overrides: |
56 virtual int RowCount(); | 57 virtual int RowCount() OVERRIDE; |
57 virtual std::wstring GetText(int row, int column_id); | 58 virtual string16 GetText(int row, int column_id) OVERRIDE; |
58 virtual void SetObserver(TableModelObserver* observer); | 59 virtual void SetObserver(TableModelObserver* observer) OVERRIDE; |
59 | 60 |
60 private: | 61 private: |
61 HostContentSettingsMap* map(bool is_off_the_record) { | 62 HostContentSettingsMap* map(bool is_off_the_record) { |
62 return is_off_the_record ? off_the_record_map_ : map_; | 63 return is_off_the_record ? off_the_record_map_ : map_; |
63 } | 64 } |
64 HostContentSettingsMap::SettingsForOneType& entries(bool is_off_the_record) { | 65 HostContentSettingsMap::SettingsForOneType& entries(bool is_off_the_record) { |
65 return is_off_the_record ? off_the_record_entries_ : entries_; | 66 return is_off_the_record ? off_the_record_entries_ : entries_; |
66 } | 67 } |
67 | 68 |
68 scoped_refptr<HostContentSettingsMap> map_; | 69 scoped_refptr<HostContentSettingsMap> map_; |
69 scoped_refptr<HostContentSettingsMap> off_the_record_map_; | 70 scoped_refptr<HostContentSettingsMap> off_the_record_map_; |
70 ContentSettingsType content_type_; | 71 ContentSettingsType content_type_; |
71 HostContentSettingsMap::SettingsForOneType entries_; | 72 HostContentSettingsMap::SettingsForOneType entries_; |
72 HostContentSettingsMap::SettingsForOneType off_the_record_entries_; | 73 HostContentSettingsMap::SettingsForOneType off_the_record_entries_; |
73 TableModelObserver* observer_; | 74 TableModelObserver* observer_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(ContentExceptionsTableModel); | 76 DISALLOW_COPY_AND_ASSIGN(ContentExceptionsTableModel); |
76 }; | 77 }; |
77 | 78 |
78 #endif // CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ | 79 #endif // CHROME_BROWSER_CONTENT_EXCEPTIONS_TABLE_MODEL_H_ |
OLD | NEW |