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 | 7 |
8 #include "chrome/common/content_settings_types.h" | 8 #include "chrome/common/content_settings_types.h" |
9 | 9 |
10 // Different settings that can be assigned for a particular content type. We | 10 // Different settings that can be assigned for a particular content type. We |
11 // give the user the ability to set these on a global and per-host basis. | 11 // give the user the ability to set these on a global and per-host basis. |
12 enum ContentSetting { | 12 enum ContentSetting { |
13 CONTENT_SETTING_DEFAULT = 0, | 13 CONTENT_SETTING_DEFAULT = 0, |
14 CONTENT_SETTING_ALLOW, | 14 CONTENT_SETTING_ALLOW, |
15 CONTENT_SETTING_BLOCK, | 15 CONTENT_SETTING_BLOCK, |
16 CONTENT_SETTING_ASK, | 16 CONTENT_SETTING_ASK, |
| 17 CONTENT_SETTING_SESSION_ONLY, |
17 CONTENT_SETTING_NUM_SETTINGS | 18 CONTENT_SETTING_NUM_SETTINGS |
18 }; | 19 }; |
19 | 20 |
20 // Range-checked conversion of an int to a ContentSetting, for use when reading | 21 // Range-checked conversion of an int to a ContentSetting, for use when reading |
21 // prefs off disk. | 22 // prefs off disk. |
22 ContentSetting IntToContentSetting(int content_setting); | 23 ContentSetting IntToContentSetting(int content_setting); |
23 | 24 |
24 // Aggregates the permissions for the different content types. | 25 // Aggregates the permissions for the different content types. |
25 struct ContentSettings { | 26 struct ContentSettings { |
26 ContentSettings() { | 27 ContentSettings() { |
27 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) | 28 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) |
28 settings[i] = CONTENT_SETTING_DEFAULT; | 29 settings[i] = CONTENT_SETTING_DEFAULT; |
29 } | 30 } |
30 | 31 |
31 explicit ContentSettings(ContentSetting default_setting) { | 32 explicit ContentSettings(ContentSetting default_setting) { |
32 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) | 33 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) |
33 settings[i] = default_setting; | 34 settings[i] = default_setting; |
34 } | 35 } |
35 | 36 |
36 ContentSetting settings[CONTENT_SETTINGS_NUM_TYPES]; | 37 ContentSetting settings[CONTENT_SETTINGS_NUM_TYPES]; |
37 }; | 38 }; |
38 | 39 |
39 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ | 40 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ |
OLD | NEW |