Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/enum_validation.h" | |
| 11 #include "chrome/common/content_settings_pattern.h" | 12 #include "chrome/common/content_settings_pattern.h" |
| 12 #include "chrome/common/content_settings_types.h" | 13 #include "chrome/common/content_settings_types.h" |
| 13 | 14 |
| 14 // 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 |
| 15 // give the user the ability to set these on a global and per-origin basis. | 16 // give the user the ability to set these on a global and per-origin basis. |
| 16 enum ContentSetting { | 17 enum ContentSetting { |
| 17 CONTENT_SETTING_DEFAULT = 0, | 18 CONTENT_SETTING_DEFAULT = 0, |
| 18 CONTENT_SETTING_ALLOW, | 19 CONTENT_SETTING_ALLOW, |
| 19 CONTENT_SETTING_BLOCK, | 20 CONTENT_SETTING_BLOCK, |
| 20 CONTENT_SETTING_ASK, | 21 CONTENT_SETTING_ASK, |
| 21 CONTENT_SETTING_SESSION_ONLY, | 22 CONTENT_SETTING_SESSION_ONLY, |
| 22 CONTENT_SETTING_NUM_SETTINGS | 23 CONTENT_SETTING_NUM_SETTINGS |
| 23 }; | 24 }; |
| 25 template <> inline bool IsIntValidForEnum<ContentSetting>(int x) { | |
|
darin (slow to review)
2013/05/31 07:11:37
I don't have a solution to offer, but this feels k
| |
| 26 return x >= CONTENT_SETTING_DEFAULT && x < CONTENT_SETTING_NUM_SETTINGS; | |
| 27 } | |
| 24 | 28 |
| 25 // Range-checked conversion of an int to a ContentSetting, for use when reading | 29 // Range-checked conversion of an int to a ContentSetting, for use when reading |
| 26 // prefs off disk. | 30 // prefs off disk. |
| 27 ContentSetting IntToContentSetting(int content_setting); | 31 ContentSetting IntToContentSetting(int content_setting); |
| 28 | 32 |
| 29 struct ContentSettingPatternSource { | 33 struct ContentSettingPatternSource { |
| 30 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern, | 34 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern, |
| 31 const ContentSettingsPattern& secondary_patttern, | 35 const ContentSettingsPattern& secondary_patttern, |
| 32 ContentSetting setting, | 36 ContentSetting setting, |
| 33 const std::string& source, | 37 const std::string& source, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // contains the patterns of the appling rule. | 72 // contains the patterns of the appling rule. |
| 69 struct SettingInfo { | 73 struct SettingInfo { |
| 70 SettingSource source; | 74 SettingSource source; |
| 71 ContentSettingsPattern primary_pattern; | 75 ContentSettingsPattern primary_pattern; |
| 72 ContentSettingsPattern secondary_pattern; | 76 ContentSettingsPattern secondary_pattern; |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 } // namespace content_settings | 79 } // namespace content_settings |
| 76 | 80 |
| 77 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ | 81 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ |
| OLD | NEW |