| 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_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // Provider that provides default content settings based on | 26 // Provider that provides default content settings based on |
| 27 // user prefs. If no default values are set by the user we use the hard coded | 27 // user prefs. If no default values are set by the user we use the hard coded |
| 28 // default values. | 28 // default values. |
| 29 class DefaultProvider : public ObservableProvider { | 29 class DefaultProvider : public ObservableProvider { |
| 30 public: | 30 public: |
| 31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 32 | 32 |
| 33 DefaultProvider(PrefService* prefs, | 33 DefaultProvider(PrefService* prefs, |
| 34 bool incognito); | 34 bool incognito); |
| 35 virtual ~DefaultProvider(); | 35 ~DefaultProvider() override; |
| 36 | 36 |
| 37 // ProviderInterface implementations. | 37 // ProviderInterface implementations. |
| 38 virtual RuleIterator* GetRuleIterator( | 38 RuleIterator* GetRuleIterator(ContentSettingsType content_type, |
| 39 ContentSettingsType content_type, | 39 const ResourceIdentifier& resource_identifier, |
| 40 const ResourceIdentifier& resource_identifier, | 40 bool incognito) const override; |
| 41 bool incognito) const override; | |
| 42 | 41 |
| 43 virtual bool SetWebsiteSetting( | 42 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
| 44 const ContentSettingsPattern& primary_pattern, | 43 const ContentSettingsPattern& secondary_pattern, |
| 45 const ContentSettingsPattern& secondary_pattern, | 44 ContentSettingsType content_type, |
| 46 ContentSettingsType content_type, | 45 const ResourceIdentifier& resource_identifier, |
| 47 const ResourceIdentifier& resource_identifier, | 46 base::Value* value) override; |
| 48 base::Value* value) override; | |
| 49 | 47 |
| 50 virtual void ClearAllContentSettingsRules( | 48 void ClearAllContentSettingsRules(ContentSettingsType content_type) override; |
| 51 ContentSettingsType content_type) override; | |
| 52 | 49 |
| 53 virtual void ShutdownOnUIThread() override; | 50 void ShutdownOnUIThread() override; |
| 54 | 51 |
| 55 private: | 52 private: |
| 56 // Sets the fields of |settings| based on the values in |dictionary|. | 53 // Sets the fields of |settings| based on the values in |dictionary|. |
| 57 void GetSettingsFromDictionary(const base::DictionaryValue* dictionary); | 54 void GetSettingsFromDictionary(const base::DictionaryValue* dictionary); |
| 58 | 55 |
| 59 // Forces the default settings to be explicitly set instead of themselves | 56 // Forces the default settings to be explicitly set instead of themselves |
| 60 // being CONTENT_SETTING_DEFAULT. | 57 // being CONTENT_SETTING_DEFAULT. |
| 61 void ForceDefaultsToBeExplicit(); | 58 void ForceDefaultsToBeExplicit(); |
| 62 | 59 |
| 63 // Reads the default settings from the preferences service. If |overwrite| is | 60 // Reads the default settings from the preferences service. If |overwrite| is |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 // Whether we are currently updating preferences, this is used to ignore | 83 // Whether we are currently updating preferences, this is used to ignore |
| 87 // notifications from the preferences service that we triggered ourself. | 84 // notifications from the preferences service that we triggered ourself. |
| 88 bool updating_preferences_; | 85 bool updating_preferences_; |
| 89 | 86 |
| 90 DISALLOW_COPY_AND_ASSIGN(DefaultProvider); | 87 DISALLOW_COPY_AND_ASSIGN(DefaultProvider); |
| 91 }; | 88 }; |
| 92 | 89 |
| 93 } // namespace content_settings | 90 } // namespace content_settings |
| 94 | 91 |
| 95 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ | 92 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ |
| OLD | NEW |