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

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

Issue 6542048: Add content_settings::PolicyProvider and a set of new policies to managed content settings. (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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "chrome/browser/content_settings/content_settings_provider.h" 10 #include "chrome/browser/content_settings/content_settings_provider.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 // The class MockProvider is a mock for a non default content settings provider. 43 // The class MockProvider is a mock for a non default content settings provider.
44 class MockProvider : public ProviderInterface { 44 class MockProvider : public ProviderInterface {
45 public: 45 public:
46 MockProvider(); 46 MockProvider();
47 MockProvider(ContentSettingsPattern requesting_url_pattern, 47 MockProvider(ContentSettingsPattern requesting_url_pattern,
48 ContentSettingsPattern embedding_url_pattern, 48 ContentSettingsPattern embedding_url_pattern,
49 ContentSettingsType content_type, 49 ContentSettingsType content_type,
50 ResourceIdentifier resource_identifier, 50 ResourceIdentifier resource_identifier,
51 ContentSetting setting, 51 ContentSetting setting,
52 bool read_only); 52 bool read_only,
53 bool is_managed);
53 virtual ~MockProvider(); 54 virtual ~MockProvider();
54 55
56 virtual bool ContentSettingsTypeIsManaged(ContentSettingsType type);
57
55 // ProviderInterface implementation 58 // ProviderInterface implementation
56 virtual ContentSetting GetContentSetting( 59 virtual ContentSetting GetContentSetting(
57 const GURL& requesting_url, 60 const GURL& requesting_url,
58 const GURL& embedding_url, 61 const GURL& embedding_url,
59 ContentSettingsType content_type, 62 ContentSettingsType content_type,
60 const ResourceIdentifier& resource_identifier) const; 63 const ResourceIdentifier& resource_identifier) const;
61 64
62 // The MockProvider is only able to store one content setting. So every time 65 // The MockProvider is only able to store one content setting. So every time
63 // this method is called the previously set content settings is overwritten. 66 // this method is called the previously set content settings is overwritten.
64 virtual void SetContentSetting( 67 virtual void SetContentSetting(
(...skipping 11 matching lines...) Expand all
76 virtual void ClearAllContentSettingsRules( 79 virtual void ClearAllContentSettingsRules(
77 ContentSettingsType content_type) {} 80 ContentSettingsType content_type) {}
78 81
79 virtual void ResetToDefaults() {} 82 virtual void ResetToDefaults() {}
80 83
81 // Accessors 84 // Accessors
82 void set_requesting_url_pattern(ContentSettingsPattern pattern) { 85 void set_requesting_url_pattern(ContentSettingsPattern pattern) {
83 requesting_url_pattern_ = pattern; 86 requesting_url_pattern_ = pattern;
84 } 87 }
85 88
86 ContentSettingsPattern requesting_url_pattern() { 89 ContentSettingsPattern requesting_url_pattern() const {
87 return requesting_url_pattern_; 90 return requesting_url_pattern_;
88 } 91 }
89 92
90 void set_embedding_url_pattern(ContentSettingsPattern pattern) { 93 void set_embedding_url_pattern(ContentSettingsPattern pattern) {
91 embedding_url_pattern_ = pattern; 94 embedding_url_pattern_ = pattern;
92 } 95 }
93 96
94 ContentSettingsPattern embedding_url_pattern() { 97 ContentSettingsPattern embedding_url_pattern() const {
95 return embedding_url_pattern_; 98 return embedding_url_pattern_;
96 } 99 }
97 100
98 void set_content_type(ContentSettingsType content_type) { 101 void set_content_type(ContentSettingsType content_type) {
99 content_type_ = content_type; 102 content_type_ = content_type;
100 } 103 }
101 104
102 ContentSettingsType content_type() { 105 ContentSettingsType content_type() const {
103 return content_type_; 106 return content_type_;
104 } 107 }
105 108
106 void set_resource_identifier(ResourceIdentifier resource_identifier) { 109 void set_resource_identifier(ResourceIdentifier resource_identifier) {
107 resource_identifier_ = resource_identifier; 110 resource_identifier_ = resource_identifier;
108 } 111 }
109 112
110 ResourceIdentifier resource_identifier() { 113 ResourceIdentifier resource_identifier() const {
111 return resource_identifier_; 114 return resource_identifier_;
112 } 115 }
113 116
114 void set_setting(ContentSetting setting) { 117 void set_setting(ContentSetting setting) {
115 setting_ = setting; 118 setting_ = setting;
116 } 119 }
117 120
118 ContentSetting setting() { 121 ContentSetting setting() const {
119 return setting_; 122 return setting_;
120 } 123 }
121 124
122 void set_read_only(bool read_only) { 125 void set_read_only(bool read_only) {
123 read_only_ = read_only; 126 read_only_ = read_only;
124 } 127 }
125 128
126 bool read_only() { 129 bool read_only() const {
127 return read_only_; 130 return read_only_;
128 } 131 }
129 132
133 void set_is_managed(bool is_managed) {
134 is_managed_ = is_managed;
135 }
136
137 bool is_managed() const {
138 return is_managed_;
139 }
140
130 private: 141 private:
131 ContentSettingsPattern requesting_url_pattern_; 142 ContentSettingsPattern requesting_url_pattern_;
132 ContentSettingsPattern embedding_url_pattern_; 143 ContentSettingsPattern embedding_url_pattern_;
133 ContentSettingsType content_type_; 144 ContentSettingsType content_type_;
134 ResourceIdentifier resource_identifier_; 145 ResourceIdentifier resource_identifier_;
135 ContentSetting setting_; 146 ContentSetting setting_;
136 bool read_only_; 147 bool read_only_;
148 bool is_managed_;
137 149
138 DISALLOW_COPY_AND_ASSIGN(MockProvider); 150 DISALLOW_COPY_AND_ASSIGN(MockProvider);
139 }; 151 };
140 152
141 } // namespace content_settings 153 } // namespace content_settings
142 154
143 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ 155 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698