OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ | |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "chrome/common/content_settings.h" | |
12 #include "chrome/common/content_settings_pattern.h" | |
13 | |
14 namespace extension_content_settings_helpers { | |
15 | |
16 // Parses an extension match pattern and returns a corresponding | |
17 // content settings pattern object. | |
18 // If |pattern_str| is invalid or can't be converted to a content settings | |
19 // pattern, |error| is set to the parsing error and an invalid pattern | |
20 // is returned. | |
21 ContentSettingsPattern ParseExtensionPattern(const std::string& pattern_str, | |
22 std::string* error); | |
23 | |
24 // Converts a content settings type string to the corresponding | |
25 // ContentSettingsType. Returns CONTENT_SETTINGS_TYPE_DEFAULT if the string | |
26 // didn't specify a valid content settings type. | |
27 ContentSettingsType StringToContentSettingsType( | |
28 const std::string& content_type); | |
29 // Returns a string representation of a ContentSettingsType. | |
30 const char* ContentSettingsTypeToString(ContentSettingsType type); | |
31 | |
32 // Converts a content setting string to the corresponding ContentSetting. | |
33 // Returns true if |setting_str| specifies a valid content setting, | |
34 // false otherwise. | |
35 bool StringToContentSetting(const std::string& setting_str, | |
36 ContentSetting* setting); | |
37 // Returns a string representation of a ContentSetting. | |
38 const char* ContentSettingToString(ContentSetting setting); | |
39 | |
40 } // namespace extension_content_settings_helpers | |
41 | |
42 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ | |
OLD | NEW |