| 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 |
| 41 class MockProvider : public ProviderInterface { |
| 42 public: |
| 43 MockProvider(); |
| 44 virtual ~MockProvider(); |
| 45 |
| 33 // ProviderInterface implementation | 46 // ProviderInterface implementation |
| 34 virtual ContentSetting GetContentSetting( | 47 virtual ContentSetting GetContentSetting( |
| 35 const GURL& requesting_url, | 48 const GURL& requesting_url, |
| 36 const GURL& embedding_url, | 49 const GURL& embedding_url, |
| 37 ContentSettingsType content_type, | 50 ContentSettingsType content_type, |
| 38 const ResourceIdentifier& resource_identifier) const { | 51 const ResourceIdentifier& resource_identifier) const { |
| 39 return CONTENT_SETTING_DEFAULT; | 52 return CONTENT_SETTING_DEFAULT; |
| 40 } | 53 } |
| 41 | 54 |
| 42 virtual void SetContentSetting( | 55 virtual void SetContentSetting( |
| 43 const ContentSettingsPattern& requesting_url_pattern, | 56 const ContentSettingsPattern& requesting_url_pattern, |
| 44 const ContentSettingsPattern& embedding_url_pattern, | 57 const ContentSettingsPattern& embedding_url_pattern, |
| 45 ContentSettingsType content_type, | 58 ContentSettingsType content_type, |
| 46 const ResourceIdentifier& resource_identifier, | 59 const ResourceIdentifier& resource_identifier, |
| 47 ContentSetting content_setting) {} | 60 ContentSetting content_setting) {} |
| 48 | 61 |
| 49 virtual void GetAllContentSettingsRules( | 62 virtual void GetAllContentSettingsRules( |
| 50 ContentSettingsType content_type, | 63 ContentSettingsType content_type, |
| 51 const ResourceIdentifier& resource_identifier, | 64 const ResourceIdentifier& resource_identifier, |
| 52 Rules* content_setting_rules) const {} | 65 Rules* content_setting_rules) const {} |
| 53 | 66 |
| 54 virtual void ClearAllContentSettingsRules() {} | 67 virtual void ClearAllContentSettingsRules( |
| 68 ContentSettingsType content_type) {} |
| 69 |
| 70 virtual void ResetToDefaults() {} |
| 55 | 71 |
| 56 private: | 72 private: |
| 57 ContentSettingsType content_type_; | |
| 58 ContentSetting setting_; | |
| 59 bool is_managed_; | |
| 60 bool can_override_; | |
| 61 | 73 |
| 62 DISALLOW_COPY_AND_ASSIGN(MockContentSettingsProvider); | 74 DISALLOW_COPY_AND_ASSIGN(MockProvider); |
| 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 |