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

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

Issue 6253012: Add ContentSettingsProvider 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
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 "chrome/browser/content_settings/content_identifier.h"
12 #include "chrome/browser/content_settings/content_settings_rule.h"
13 #include "chrome/browser/content_settings/host.h"
14 #include "chrome/browser/content_settings/host_pattern.h"
Bernhard Bauer 2011/01/26 10:25:18 If these are classes, I guess you could just forwa
markusheintz_ 2011/01/26 15:27:08 Will fix when clear which of this classes stay.
11 #include "chrome/common/content_settings.h" 15 #include "chrome/common/content_settings.h"
12 16
17 using content_settings::ContentIdentifier;
Bernhard Bauer 2011/01/26 10:25:18 We don't use namespace imports in header files, on
markusheintz_ 2011/01/26 15:27:08 I put the ContentSettingsProvider in the content_s
18 using content_settings::ContentSettingsRule;
19 using content_settings::ContentSettingsRulePtr;
20 using content_settings::ContentSettingsRules;
21 using content_settings::Host;
22 using content_settings::HostPattern;
23
24 class GURL;
25
13 class DefaultContentSettingsProvider { 26 class DefaultContentSettingsProvider {
14 public: 27 public:
15 virtual ~DefaultContentSettingsProvider() {} 28 virtual ~DefaultContentSettingsProvider() {}
16 29
17 // True if this provider can provide a default setting for the |content_type|. 30 // True if this provider can provide a default setting for the |content_type|.
18 virtual bool CanProvideDefaultSetting( 31 virtual bool CanProvideDefaultSetting(
19 ContentSettingsType content_type) const = 0; 32 ContentSettingsType content_type) const = 0;
20 33
21 // Returns the default content setting this provider has for the given 34 // Returns the default content setting this provider has for the given
22 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this 35 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this
23 // type. 36 // type.
24 virtual ContentSetting ProvideDefaultSetting( 37 virtual ContentSetting ProvideDefaultSetting(
25 ContentSettingsType content_type) const = 0; 38 ContentSettingsType content_type) const = 0;
26 39
27 // Notifies the provider that the host content settings map would like to 40 // Notifies the provider that the host content settings map would like to
28 // update the default setting for the given |content_type|. The provider may 41 // update the default setting for the given |content_type|. The provider may
29 // ignore this. 42 // ignore this.
30 virtual void UpdateDefaultSetting(ContentSettingsType content_type, 43 virtual void UpdateDefaultSetting(ContentSettingsType content_type,
31 ContentSetting setting) = 0; 44 ContentSetting setting) = 0;
32 45
33 // Resets the state of the provider to the default. 46 // Resets the state of the provider to the default.
34 virtual void ResetToDefaults() = 0; 47 virtual void ResetToDefaults() = 0;
35 48
36 // True if the default setting for the |content_type| is policy managed, i.e., 49 // 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. 50 // there shouldn't be any UI shown to modify this setting.
38 virtual bool DefaultSettingIsManaged( 51 virtual bool DefaultSettingIsManaged(
39 ContentSettingsType content_type) const = 0; 52 ContentSettingsType content_type) const = 0;
40 }; 53 };
41 54
55 class ContentSettingsProvider {
jochen (gone - plz use gerrit) 2011/01/26 11:29:18 public: missing
markusheintz_ 2011/01/26 15:27:08 Done.
56 virtual ~ContentSettingsProvider() {}
jochen (gone - plz use gerrit) 2011/01/26 11:29:18 where is isManaged, isReadOnly, and canProvide? P
Bernhard Bauer 2011/01/26 11:34:23 We don't need it anymore with the new interface :)
markusheintz_ 2011/01/26 15:27:08 Don't need them. I think the enum should live in
57
58 // Returns the ContentSetting for the given |host| and |content_identifier|.
59 //
Bernhard Bauer 2011/01/26 10:25:18 Nit: remove empty comment lines.
markusheintz_ 2011/01/26 15:27:08 Done.
60 // This may be called on any thread.
61 virtual ContentSetting GetContentSetting(
62 const Host& host,
63 const ContentIdentifier& content_identifier) const = 0;
64
65 // Sets the |content_setting| for the given |host| and |content_identifier|.
66 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting for
67 // that type to be used when loading pages matching this pattern.
68 //
69 // This should only be called on the UI thread.
70 virtual void SetContentSetting(
71 const Host& host,
Bernhard Bauer 2011/01/26 10:25:18 Should this take a pattern?
markusheintz_ 2011/01/26 15:27:08 of course! :) done
72 const ContentIdentifier& content_identifier,
73 ContentSetting content_setting) = 0;
74
75 // For the given |content_identifier| return all content-setting-rules with a
76 // non-default setting.
77 //
78 // This may be called on any thread.
79 virtual void GetAllContentSettingsRules(
80 const ContentIdentifier& content_identifier,
81 ContentSettingsRules* content_setting_rules) const = 0;
82
83 // Clears all content-setting-rules for the given |content_identifier|.
84 //
85 // This should only be called on the UI thread.
86 virtual void ClearAllContentSettingsRules(
87 const ContentIdentifier& content_identifier) = 0;
88 };
89
42 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 90 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698