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

Side by Side Diff: chrome/browser/content_settings/content_settings_provider.h

Issue 6242013: Add LegacyContentSettingsProvider Interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Interface for objects providing content setting rules. 5 // Interface for objects providing content setting rules.
6 6
7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
9 #pragma once 9 #pragma once
10 10
11 #include <vector>
12
13 #include "chrome/browser/content_settings/content_settings_pattern.h"
11 #include "chrome/common/content_settings.h" 14 #include "chrome/common/content_settings.h"
15 #include "googleurl/src/gurl.h"
Bernhard Bauer 2011/01/26 14:50:47 Forward-declare GURL?
markusheintz_ 2011/01/26 16:27:47 Done.
12 16
13 class DefaultContentSettingsProvider { 17 class DefaultContentSettingsProvider {
14 public: 18 public:
15 virtual ~DefaultContentSettingsProvider() {} 19 virtual ~DefaultContentSettingsProvider() {}
16 20
17 // True if this provider can provide a default setting for the |content_type|. 21 // True if this provider can provide a default setting for the |content_type|.
18 virtual bool CanProvideDefaultSetting( 22 virtual bool CanProvideDefaultSetting(
19 ContentSettingsType content_type) const = 0; 23 ContentSettingsType content_type) const = 0;
20 24
21 // Returns the default content setting this provider has for the given 25 // Returns the default content setting this provider has for the given
(...skipping 10 matching lines...) Expand all
32 36
33 // Resets the state of the provider to the default. 37 // Resets the state of the provider to the default.
34 virtual void ResetToDefaults() = 0; 38 virtual void ResetToDefaults() = 0;
35 39
36 // True if the default setting for the |content_type| is policy managed, i.e., 40 // True if the default setting for the |content_type| is policy managed, i.e.,
37 // there shouldn't be any UI shown to modify this setting. 41 // there shouldn't be any UI shown to modify this setting.
38 virtual bool DefaultSettingIsManaged( 42 virtual bool DefaultSettingIsManaged(
39 ContentSettingsType content_type) const = 0; 43 ContentSettingsType content_type) const = 0;
40 }; 44 };
41 45
46 class LegacyContentSettingsProvider {
47 public:
48
Bernhard Bauer 2011/01/26 14:50:47 Remove blank line. Also, you should add a virtual
markusheintz_ 2011/01/26 16:27:47 Done.
49 // LEGACY ContentSettingsProvider interface
50
51 typedef std::pair<ContentSettingsPattern, ContentSetting> PatternSettingPair;
52 typedef std::vector<PatternSettingPair> SettingsForOneType;
53
54 // Returns a single ContentSetting which applies to a given URL. Note that
55 // certain internal schemes are whitelisted. For ContentSettingsTypes that
56 // require an resource identifier to be specified, the |resource_identifier|
57 // must be non-empty.
58 //
59 // This may be called on any thread.
60 virtual ContentSetting GetContentSetting(
61 const GURL& url,
62 ContentSettingsType content_type,
63 const std::string& resource_identifier) const = 0;
64
65 // Returns a single ContentSetting which applies to a given URL or
66 // CONTENT_SETTING_DEFAULT, if no exception applies. Note that certain
67 // internal schemes are whitelisted. For ContentSettingsTypes that require an
68 // resource identifier to be specified, the |resource_identifier| must be
69 // non-empty.
70 //
71 // This may be called on any thread.
72 virtual ContentSetting GetNonDefaultContentSetting(
73 const GURL& url,
74 ContentSettingsType content_type,
75 const std::string& resource_identifier) const = 0;
76
77 // Returns all ContentSettings which apply to a given URL. For content
78 // setting types that require an additional resource identifier, the default
79 // content setting is returned.
80 //
81 // This may be called on any thread.
82 virtual ContentSettings GetContentSettings(const GURL& url) const = 0;
83
84 // Returns all non-default ContentSettings which apply to a given URL. For
85 // content setting types that require an additional resource identifier,
86 // CONTENT_SETTING_DEFAULT is returned.
87 //
88 // This may be called on any thread.
89 virtual ContentSettings GetNonDefaultContentSettings(const GURL& url) const = 0;
Bernhard Bauer 2011/01/26 14:50:47 80 cols
markusheintz_ 2011/01/26 16:27:47 Done.
90
91 // For a given content type, returns all patterns with a non-default setting,
92 // mapped to their actual settings, in lexicographical order. |settings|
93 // must be a non-NULL outparam. If this map was created for the
94 // off-the-record profile, it will only return those settings differing from
95 // the main map. For ContentSettingsTypes that require an resource identifier
96 // to be specified, the |resource_identifier| must be non-empty.
97 //
98 // This may be called on any thread.
99 virtual void GetSettingsForOneType(ContentSettingsType content_type,
100 const std::string& resource_identifier,
Bernhard Bauer 2011/01/26 14:50:47 Methinks your editor is indent-technically challen
markusheintz_ 2011/01/26 16:27:47 Done.
101 SettingsForOneType* settings) const = 0;
102
103 // Sets the blocking setting for a particular pattern and content type.
104 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting
105 // for that type to be used when loading pages matching this pattern. For
106 // ContentSettingsTypes that require an resource identifier to be specified,
107 // the |resource_identifier| must be non-empty.
108 //
109 // This should only be called on the UI thread.
110 virtual void SetContentSetting(const ContentSettingsPattern& pattern,
111 ContentSettingsType content_type,
112 const std::string& resource_identifier,
113 ContentSetting setting) = 0;
114
115 // Convenience method to add a content setting for a given URL, making sure
116 // that there is no setting overriding it. For ContentSettingsTypes that
117 // require an resource identifier to be specified, the |resource_identifier|
118 // must be non-empty.
119 //
120 // This should only be called on the UI thread.
121 virtual void AddExceptionForURL(const GURL& url,
122 ContentSettingsType content_type,
123 const std::string& resource_identifier,
124 ContentSetting setting) = 0;
125
126 // Clears all host-specific settings for one content type.
127 //
128 // This should only be called on the UI thread.
129 virtual void ClearSettingsForOneType(ContentSettingsType content_type) = 0;
130
131 // Resets all settings levels.
132 //
133 // This should only be called on the UI thread.
134 virtual void ResetToDefaults() = 0;
135
Bernhard Bauer 2011/01/26 14:50:47 Remove blank line
markusheintz_ 2011/01/26 16:27:47 Done.
136 };
137
42 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 138 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698