OLD | NEW |
---|---|
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_MOCK_CONTENT_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_MOCK_CONTENT_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_MOCK_CONTENT_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_MOCK_CONTENT_SETTINGS_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" |
11 | 11 |
12 namespace content_settings { | 12 namespace content_settings { |
13 | 13 |
14 class MockContentSettingsProvider : public DefaultProviderInterface, | 14 class MockContentSettingsProvider : public DefaultProviderInterface { |
15 public ProviderInterface { | |
16 public: | 15 public: |
17 // Create a content settings provider that provides a given setting for a | 16 // Create a content settings provider that provides a given setting for a |
18 // given type. | 17 // given type. |
19 MockContentSettingsProvider(ContentSettingsType content_type, | 18 MockContentSettingsProvider(ContentSettingsType content_type, |
20 ContentSetting setting, | 19 ContentSetting setting, |
21 bool is_managed, | 20 bool is_managed, |
22 bool can_override); | 21 bool can_override); |
23 virtual ~MockContentSettingsProvider(); | 22 virtual ~MockContentSettingsProvider(); |
24 | 23 |
25 // DefaultProviderInterface implementation. | 24 // DefaultProviderInterface implementation. |
26 virtual ContentSetting ProvideDefaultSetting( | 25 virtual ContentSetting ProvideDefaultSetting( |
27 ContentSettingsType content_type) const; | 26 ContentSettingsType content_type) const; |
28 virtual void UpdateDefaultSetting(ContentSettingsType content_type, | 27 virtual void UpdateDefaultSetting(ContentSettingsType content_type, |
29 ContentSetting setting); | 28 ContentSetting setting); |
30 virtual void ResetToDefaults(); | 29 virtual void ResetToDefaults(); |
31 virtual bool DefaultSettingIsManaged(ContentSettingsType content_type) const; | 30 virtual bool DefaultSettingIsManaged(ContentSettingsType content_type) const; |
32 | 31 |
32 private: | |
33 ContentSettingsType content_type_; | |
34 ContentSetting setting_; | |
35 bool is_managed_; | |
36 bool can_override_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(MockContentSettingsProvider); | |
39 }; | |
40 | |
jochen (gone - plz use gerrit)
2011/02/04 08:38:43
only one empty line here
markusheintz_
2011/02/04 10:08:03
Done.
| |
41 | |
42 class MockProvider : public ProviderInterface { | |
43 public: | |
44 MockProvider(); | |
45 virtual ~MockProvider(); | |
46 | |
33 // ProviderInterface implementation | 47 // ProviderInterface implementation |
34 virtual ContentSetting GetContentSetting( | 48 virtual ContentSetting GetContentSetting( |
35 const GURL& requesting_url, | 49 const GURL& requesting_url, |
36 const GURL& embedding_url, | 50 const GURL& embedding_url, |
37 ContentSettingsType content_type, | 51 ContentSettingsType content_type, |
38 const ResourceIdentifier& resource_identifier) const { | 52 const ResourceIdentifier& resource_identifier) const { |
39 return CONTENT_SETTING_DEFAULT; | 53 return CONTENT_SETTING_DEFAULT; |
40 } | 54 } |
41 | 55 |
42 virtual void SetContentSetting( | 56 virtual void SetContentSetting( |
43 const ContentSettingsPattern& requesting_url_pattern, | 57 const ContentSettingsPattern& requesting_url_pattern, |
44 const ContentSettingsPattern& embedding_url_pattern, | 58 const ContentSettingsPattern& embedding_url_pattern, |
45 ContentSettingsType content_type, | 59 ContentSettingsType content_type, |
46 const ResourceIdentifier& resource_identifier, | 60 const ResourceIdentifier& resource_identifier, |
47 ContentSetting content_setting) {} | 61 ContentSetting content_setting) {} |
48 | 62 |
49 virtual void GetAllContentSettingsRules( | 63 virtual void GetAllContentSettingsRules( |
50 ContentSettingsType content_type, | 64 ContentSettingsType content_type, |
51 const ResourceIdentifier& resource_identifier, | 65 const ResourceIdentifier& resource_identifier, |
52 Rules* content_setting_rules) const {} | 66 Rules* content_setting_rules) const {} |
53 | 67 |
54 virtual void ClearAllContentSettingsRules() {} | 68 virtual void ClearAllContentSettingsRules( |
69 ContentSettingsType content_type) {} | |
70 | |
71 virtual void ResetToDefaults() {} | |
55 | 72 |
56 private: | 73 private: |
57 ContentSettingsType content_type_; | 74 DISALLOW_COPY_AND_ASSIGN(MockProvider); |
jochen (gone - plz use gerrit)
2011/02/04 08:38:43
empty line before this line
markusheintz_
2011/02/04 10:08:03
Done.
| |
58 ContentSetting setting_; | |
59 bool is_managed_; | |
60 bool can_override_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(MockContentSettingsProvider); | |
63 }; | 75 }; |
64 | 76 |
65 } // namespace content_settings | 77 } // namespace content_settings |
66 | 78 |
67 #endif // CHROME_BROWSER_CONTENT_SETTINGS_MOCK_CONTENT_SETTINGS_PROVIDER_H_ | 79 #endif // CHROME_BROWSER_CONTENT_SETTINGS_MOCK_CONTENT_SETTINGS_PROVIDER_H_ |
OLD | NEW |