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_COMMON_CONTENT_SETTINGS_H_ | 5 #ifndef CHROME_COMMON_CONTENT_SETTINGS_H_ |
6 #define CHROME_COMMON_CONTENT_SETTINGS_H_ | 6 #define CHROME_COMMON_CONTENT_SETTINGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "chrome/common/content_settings_pattern.h" | |
9 #include "chrome/common/content_settings_types.h" | 13 #include "chrome/common/content_settings_types.h" |
10 | 14 |
11 // Different settings that can be assigned for a particular content type. We | 15 // Different settings that can be assigned for a particular content type. We |
12 // give the user the ability to set these on a global and per-host basis. | 16 // give the user the ability to set these on a global and per-host basis. |
13 enum ContentSetting { | 17 enum ContentSetting { |
14 CONTENT_SETTING_DEFAULT = 0, | 18 CONTENT_SETTING_DEFAULT = 0, |
15 CONTENT_SETTING_ALLOW, | 19 CONTENT_SETTING_ALLOW, |
16 CONTENT_SETTING_BLOCK, | 20 CONTENT_SETTING_BLOCK, |
17 CONTENT_SETTING_ASK, | 21 CONTENT_SETTING_ASK, |
18 CONTENT_SETTING_SESSION_ONLY, | 22 CONTENT_SETTING_SESSION_ONLY, |
19 CONTENT_SETTING_NUM_SETTINGS | 23 CONTENT_SETTING_NUM_SETTINGS |
20 }; | 24 }; |
21 | 25 |
22 // Range-checked conversion of an int to a ContentSetting, for use when reading | 26 // Range-checked conversion of an int to a ContentSetting, for use when reading |
23 // prefs off disk. | 27 // prefs off disk. |
24 ContentSetting IntToContentSetting(int content_setting); | 28 ContentSetting IntToContentSetting(int content_setting); |
25 | 29 |
26 // Aggregates the permissions for the different content types. | 30 // Aggregates the permissions for the different content types. |
27 struct ContentSettings { | 31 struct ContentSettings { |
Bernhard Bauer
2011/10/20 09:21:53
While you're at it, could you out-of-line these me
marja
2011/10/20 11:44:22
Done.
| |
28 ContentSettings() { | 32 ContentSettings() { |
29 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) | 33 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) |
30 settings[i] = CONTENT_SETTING_DEFAULT; | 34 settings[i] = CONTENT_SETTING_DEFAULT; |
31 } | 35 } |
32 | 36 |
33 explicit ContentSettings(ContentSetting default_setting) { | 37 explicit ContentSettings(ContentSetting default_setting) { |
34 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) | 38 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) |
35 settings[i] = default_setting; | 39 settings[i] = default_setting; |
36 } | 40 } |
37 | 41 |
38 ContentSetting settings[CONTENT_SETTINGS_NUM_TYPES]; | 42 ContentSetting settings[CONTENT_SETTINGS_NUM_TYPES]; |
39 }; | 43 }; |
40 | 44 |
45 struct ContentSettingPatternSource { | |
46 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern, | |
47 const ContentSettingsPattern& secondary_patttern, | |
48 ContentSetting setting, | |
49 const std::string& source, | |
50 bool incognito); | |
51 ContentSettingPatternSource(); | |
52 ContentSettingsPattern primary_pattern; | |
53 ContentSettingsPattern secondary_pattern; | |
54 ContentSetting setting; | |
55 std::string source; | |
56 bool incognito; | |
57 }; | |
58 | |
59 typedef std::vector<ContentSettingPatternSource> ContentSettingsForOneType; | |
60 | |
41 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ | 61 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ |
OLD | NEW |