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

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, 10 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_settings_pattern.h"
12 #include "chrome/browser/content_settings/content_settings_rule.h"
11 #include "chrome/common/content_settings.h" 13 #include "chrome/common/content_settings.h"
12 14
15 class GURL;
16
17 namespace content_settings {
18
13 class DefaultContentSettingsProvider { 19 class DefaultContentSettingsProvider {
14 public: 20 public:
15 virtual ~DefaultContentSettingsProvider() {} 21 virtual ~DefaultContentSettingsProvider() {}
16 22
17 // True if this provider can provide a default setting for the |content_type|. 23 // True if this provider can provide a default setting for the |content_type|.
18 virtual bool CanProvideDefaultSetting( 24 virtual bool CanProvideDefaultSetting(
19 ContentSettingsType content_type) const = 0; 25 ContentSettingsType content_type) const = 0;
20 26
21 // Returns the default content setting this provider has for the given 27 // Returns the default content setting this provider has for the given
22 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this 28 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this
23 // type. 29 // type.
24 virtual ContentSetting ProvideDefaultSetting( 30 virtual ContentSetting ProvideDefaultSetting(
25 ContentSettingsType content_type) const = 0; 31 ContentSettingsType content_type) const = 0;
26 32
27 // Notifies the provider that the host content settings map would like to 33 // 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 34 // update the default setting for the given |content_type|. The provider may
29 // ignore this. 35 // ignore this.
30 virtual void UpdateDefaultSetting(ContentSettingsType content_type, 36 virtual void UpdateDefaultSetting(ContentSettingsType content_type,
31 ContentSetting setting) = 0; 37 ContentSetting setting) = 0;
32 38
33 // Resets the state of the provider to the default. 39 // Resets the state of the provider to the default.
34 virtual void ResetToDefaults() = 0; 40 virtual void ResetToDefaults() = 0;
35 41
36 // True if the default setting for the |content_type| is policy managed, i.e., 42 // 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. 43 // there shouldn't be any UI shown to modify this setting.
38 virtual bool DefaultSettingIsManaged( 44 virtual bool DefaultSettingIsManaged(
39 ContentSettingsType content_type) const = 0; 45 ContentSettingsType content_type) const = 0;
40 }; 46 };
41 47
48 class ContentSettingsProvider {
49 public:
50 typedef std::string ResourceIdentifier;
51 typedef std::pair<ContentSettingsType, ResourceIdentifier> ContentIdentifier;
52
53 virtual ~ContentSettingsProvider() {}
54
55 // This may be called on any thread.
56 virtual ContentSetting GetContentSetting(
57 const GURL requesting_url,
58 const GURL embedding_url,
59 const ContentIdentifier& content_identifier) const = 0;
60
61 // This should only be called on the UI thread.
62 virtual void SetContentSetting(
63 const ContentSettingsPattern& requesting_pattern,
64 const ContentSettingsPattern& embedding_pattern,
65 const ContentIdentifier& content_identifier,
66 ContentSetting content_setting) = 0;
67
68 // This may be called on any thread.
69 virtual void GetAllContentSettingsRules(
70 const ContentIdentifier& content_identifier,
71 ContentSettingsRules* content_setting_rules) const = 0;
72
73 // This should only be called on the UI thread.
74 virtual void ClearAllContentSettingsRules(
75 const ContentIdentifier& content_identifier) = 0;
76 };
77
78 } // namespace content_settings
79
42 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 80 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698