| 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 COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // TODO(vabr): Get these constants through the ContentSettingsClient. | 54 // TODO(vabr): Get these constants through the ContentSettingsClient. |
| 55 const char kChromeDevToolsScheme[] = "chrome-devtools"; | 55 const char kChromeDevToolsScheme[] = "chrome-devtools"; |
| 56 const char kChromeUIScheme[] = "chrome"; | 56 const char kChromeUIScheme[] = "chrome"; |
| 57 | 57 |
| 58 #if defined(ENABLE_EXTENSIONS) | 58 #if defined(ENABLE_EXTENSIONS) |
| 59 const char kExtensionScheme[] = "chrome-extension"; | 59 const char kExtensionScheme[] = "chrome-extension"; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 std::string ContentSettingToString(ContentSetting setting); | 62 std::string ContentSettingToString(ContentSetting setting); |
| 63 | 63 |
| 64 ContentSetting ContentSettingFromString(const std::string& name); | 64 // Converts a content setting string to the corresponding ContentSetting. |
| 65 // Returns true if |name| specifies a valid content setting, false otherwise. |
| 66 bool ContentSettingFromString(const std::string& name, ContentSetting* setting); |
| 65 | 67 |
| 66 // Converts |Value| to |ContentSetting|. | 68 // Converts |Value| to |ContentSetting|. |
| 67 ContentSetting ValueToContentSetting(const base::Value* value); | 69 ContentSetting ValueToContentSetting(const base::Value* value); |
| 68 | 70 |
| 69 // Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes | 71 // Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes |
| 70 // a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| | 72 // a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| |
| 71 // is encoded as a NULL value, so it is not allowed as an integer value. | 73 // is encoded as a NULL value, so it is not allowed as an integer value. |
| 72 bool ParseContentSettingValue(const base::Value* value, | 74 bool ParseContentSettingValue(const base::Value* value, |
| 73 ContentSetting* setting); | 75 ContentSetting* setting); |
| 74 | 76 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 101 ContentSettingsPattern* secondary_pattern); | 103 ContentSettingsPattern* secondary_pattern); |
| 102 | 104 |
| 103 // Populates |rules| with content setting rules for content types that are | 105 // Populates |rules| with content setting rules for content types that are |
| 104 // handled by the renderer. | 106 // handled by the renderer. |
| 105 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 107 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
| 106 RendererContentSettingRules* rules); | 108 RendererContentSettingRules* rules); |
| 107 | 109 |
| 108 } // namespace content_settings | 110 } // namespace content_settings |
| 109 | 111 |
| 110 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 112 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| OLD | NEW |