OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SETTINGS_CONTENT_SETTINGS_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class ProviderInterface; | 24 class ProviderInterface; |
25 class RuleIterator; | 25 class RuleIterator; |
26 | 26 |
27 typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair; | 27 typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair; |
28 | 28 |
29 std::string GetTypeName(ContentSettingsType type); | 29 std::string GetTypeName(ContentSettingsType type); |
30 | 30 |
31 bool GetTypeFromName(const std::string& name, | 31 bool GetTypeFromName(const std::string& name, |
32 ContentSettingsType* return_setting); | 32 ContentSettingsType* return_setting); |
33 | 33 |
| 34 std::string ContentSettingToString(ContentSetting setting); |
| 35 |
| 36 ContentSetting ContentSettingFromString(const std::string& name); |
| 37 |
34 // Converts |Value| to |ContentSetting|. | 38 // Converts |Value| to |ContentSetting|. |
35 ContentSetting ValueToContentSetting(const base::Value* value); | 39 ContentSetting ValueToContentSetting(const base::Value* value); |
36 | 40 |
37 // Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes | 41 // Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes |
38 // a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| | 42 // a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| |
39 // is encoded as a NULL value, so it is not allowed as an integer value. | 43 // is encoded as a NULL value, so it is not allowed as an integer value. |
40 bool ParseContentSettingValue(const base::Value* value, | 44 bool ParseContentSettingValue(const base::Value* value, |
41 ContentSetting* setting); | 45 ContentSetting* setting); |
42 | 46 |
43 PatternPair ParsePatternString(const std::string& pattern_str); | 47 PatternPair ParsePatternString(const std::string& pattern_str); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool include_incognito); | 85 bool include_incognito); |
82 | 86 |
83 // Populates |rules| with content setting rules for content types that are | 87 // Populates |rules| with content setting rules for content types that are |
84 // handled by the renderer. | 88 // handled by the renderer. |
85 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 89 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
86 RendererContentSettingRules* rules); | 90 RendererContentSettingRules* rules); |
87 | 91 |
88 } // namespace content_settings | 92 } // namespace content_settings |
89 | 93 |
90 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ | 94 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ |
OLD | NEW |