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

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: Remove ContentSettingsTypeIsManaged method from ProviderInterface 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
« 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 <string>
12 #include <vector>
13
14 #include "chrome/browser/content_settings/content_settings_pattern.h"
11 #include "chrome/common/content_settings.h" 15 #include "chrome/common/content_settings.h"
12 16
17 class GURL;
18
13 namespace content_settings { 19 namespace content_settings {
14 20
15 class DefaultProviderInterface { 21 class DefaultProviderInterface {
16 public: 22 public:
17 virtual ~DefaultProviderInterface() {} 23 virtual ~DefaultProviderInterface() {}
18 24
19 // True if this provider can provide a default setting for the |content_type|. 25 // True if this provider can provide a default setting for the |content_type|.
20 virtual bool CanProvideDefaultSetting( 26 virtual bool CanProvideDefaultSetting(
21 ContentSettingsType content_type) const = 0; 27 ContentSettingsType content_type) const = 0;
22 28
(...skipping 11 matching lines...) Expand all
34 40
35 // Resets the state of the provider to the default. 41 // Resets the state of the provider to the default.
36 virtual void ResetToDefaults() = 0; 42 virtual void ResetToDefaults() = 0;
37 43
38 // True if the default setting for the |content_type| is policy managed, i.e., 44 // True if the default setting for the |content_type| is policy managed, i.e.,
39 // there shouldn't be any UI shown to modify this setting. 45 // there shouldn't be any UI shown to modify this setting.
40 virtual bool DefaultSettingIsManaged( 46 virtual bool DefaultSettingIsManaged(
41 ContentSettingsType content_type) const = 0; 47 ContentSettingsType content_type) const = 0;
42 }; 48 };
43 49
50 class ProviderInterface {
51 public:
52 typedef std::string ResourceIdentifier;
53
54 struct Rule {
55 Rule() {}
56 Rule(const ContentSettingsPattern& requesting_url_pattern,
57 const ContentSettingsPattern& embedding_url_pattern,
58 ContentSetting& setting)
59 : requesting_url_pattern_(requesting_url_pattern),
60 embedding_url_pattern_(embedding_url_pattern),
61 content_setting_(setting) {}
62
63 const ContentSettingsPattern requesting_url_pattern_;
64 const ContentSettingsPattern embedding_url_pattern_;
65 ContentSetting content_setting_;
66 };
67
68 typedef std::vector<Rule> Rules;
69
70 virtual ~ProviderInterface() {}
71
72 // This may be called on any thread.
73 virtual ContentSetting GetContentSetting(
74 const GURL requesting_url,
Bernhard Bauer 2011/02/01 09:38:43 Nit: const GURL&
markusheintz_ 2011/02/01 10:09:37 Done.
75 const GURL embedding_url,
76 const ContentSettingsType& content_type,
77 const ResourceIdentifier& resource_identifier) const = 0;
78
79 // This should only be called on the UI thread.
80 virtual void SetContentSetting(
81 const ContentSettingsPattern& requesting_pattern,
82 const ContentSettingsPattern& embedding_pattern,
83 const ContentSettingsType& content_type,
84 const ResourceIdentifier& resource_identifier,
85 ContentSetting content_setting) = 0;
86
87 // This may be called on any thread.
88 virtual void GetAllContentSettingsRules(
89 const ContentSettingsType& content_type,
90 const ResourceIdentifier& resource_identifier,
91 Rules* content_setting_rules) const = 0;
92
93 // This should only be called on the UI thread.
94 virtual void ClearAllContentSettingsRules() = 0;
95 };
96
44 } // namespace content_settings 97 } // namespace content_settings
45 98
46 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ 99 #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