Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: chrome/browser/extensions/extension_content_settings_helpers.h

Issue 7229012: Use extension match pattern syntax in content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize port Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/content_settings/content_settings_pattern.h"
11 #include "chrome/common/content_settings.h" 12 #include "chrome/common/content_settings.h"
12 13
13 namespace extension_content_settings_helpers { 14 namespace extension_content_settings_helpers {
14 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
15 // Converts a content settings type string to the corresponding 24 // Converts a content settings type string to the corresponding
16 // ContentSettingsType. Returns CONTENT_SETTINGS_TYPE_DEFAULT if the string 25 // ContentSettingsType. Returns CONTENT_SETTINGS_TYPE_DEFAULT if the string
17 // didn't specify a valid content settings type. 26 // didn't specify a valid content settings type.
18 ContentSettingsType StringToContentSettingsType( 27 ContentSettingsType StringToContentSettingsType(
19 const std::string& content_type); 28 const std::string& content_type);
20 // Returns a string representation of a ContentSettingsType. 29 // Returns a string representation of a ContentSettingsType.
21 const char* ContentSettingsTypeToString(ContentSettingsType type); 30 const char* ContentSettingsTypeToString(ContentSettingsType type);
22 31
23 // Converts a content setting string to the corresponding ContentSetting. 32 // Converts a content setting string to the corresponding ContentSetting.
24 // Returns true if |setting_str| specifies a valid content setting, 33 // Returns true if |setting_str| specifies a valid content setting,
25 // false otherwise. 34 // false otherwise.
26 bool StringToContentSetting(const std::string& setting_str, 35 bool StringToContentSetting(const std::string& setting_str,
27 ContentSetting* setting); 36 ContentSetting* setting);
28 // Returns a string representation of a ContentSetting. 37 // Returns a string representation of a ContentSetting.
29 const char* ContentSettingToString(ContentSetting setting); 38 const char* ContentSettingToString(ContentSetting setting);
30 39
31 } // namespace extension_content_settings_helpers 40 } // namespace extension_content_settings_helpers
32 41
33 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__ 42 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_HELPERS_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698