| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
| 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 typedef base::Callback<void(const ContentSettingsPattern&, | 37 typedef base::Callback<void(const ContentSettingsPattern&, |
| 38 const ContentSettingsPattern&, | 38 const ContentSettingsPattern&, |
| 39 ContentSettingsType, | 39 ContentSettingsType, |
| 40 const std::string&)> NotifyObserversCallback; | 40 const std::string&)> NotifyObserversCallback; |
| 41 | 41 |
| 42 ContentSettingsPref(ContentSettingsType content_type, | 42 ContentSettingsPref(ContentSettingsType content_type, |
| 43 PrefService* prefs, | 43 PrefService* prefs, |
| 44 PrefChangeRegistrar* registrar, | 44 PrefChangeRegistrar* registrar, |
| 45 const std::string& pref_name, | 45 const std::string& pref_name, |
| 46 bool incognito, | 46 bool incognito, |
| 47 bool store_last_modified, | |
| 48 NotifyObserversCallback notify_callback); | 47 NotifyObserversCallback notify_callback); |
| 49 ~ContentSettingsPref(); | 48 ~ContentSettingsPref(); |
| 50 | 49 |
| 51 // Returns nullptr to indicate the RuleIterator is empty. | 50 // Returns nullptr to indicate the RuleIterator is empty. |
| 52 std::unique_ptr<RuleIterator> GetRuleIterator( | 51 std::unique_ptr<RuleIterator> GetRuleIterator( |
| 53 const ResourceIdentifier& resource_identifier, | 52 const ResourceIdentifier& resource_identifier, |
| 54 bool incognito) const; | 53 bool incognito) const; |
| 55 | 54 |
| 56 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, | 55 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
| 57 const ContentSettingsPattern& secondary_pattern, | 56 const ContentSettingsPattern& secondary_pattern, |
| 58 const ResourceIdentifier& resource_identifier, | 57 const ResourceIdentifier& resource_identifier, |
| 58 base::Time modified_time, |
| 59 base::Value* value); | 59 base::Value* value); |
| 60 | 60 |
| 61 // Returns the |last_modified| date of a setting. | 61 // Returns the |last_modified| date of a setting. |
| 62 base::Time GetWebsiteSettingLastModified( | 62 base::Time GetWebsiteSettingLastModified( |
| 63 const ContentSettingsPattern& primary_pattern, | 63 const ContentSettingsPattern& primary_pattern, |
| 64 const ContentSettingsPattern& secondary_pattern, | 64 const ContentSettingsPattern& secondary_pattern, |
| 65 const ResourceIdentifier& resource_identifier); | 65 const ResourceIdentifier& resource_identifier); |
| 66 | 66 |
| 67 void ClearPref(); | 67 void ClearPref(); |
| 68 | 68 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 PrefService* prefs_; | 106 PrefService* prefs_; |
| 107 | 107 |
| 108 // Owned by the PrefProvider. | 108 // Owned by the PrefProvider. |
| 109 PrefChangeRegistrar* registrar_; | 109 PrefChangeRegistrar* registrar_; |
| 110 | 110 |
| 111 // Name of the dictionary preference managed by this class. | 111 // Name of the dictionary preference managed by this class. |
| 112 const std::string& pref_name_; | 112 const std::string& pref_name_; |
| 113 | 113 |
| 114 bool is_incognito_; | 114 bool is_incognito_; |
| 115 | 115 |
| 116 bool store_last_modified_; | |
| 117 | |
| 118 // Whether we are currently updating preferences, this is used to ignore | 116 // Whether we are currently updating preferences, this is used to ignore |
| 119 // notifications from the preferences service that we triggered ourself. | 117 // notifications from the preferences service that we triggered ourself. |
| 120 bool updating_preferences_; | 118 bool updating_preferences_; |
| 121 | 119 |
| 122 OriginIdentifierValueMap value_map_; | 120 OriginIdentifierValueMap value_map_; |
| 123 | 121 |
| 124 OriginIdentifierValueMap incognito_value_map_; | 122 OriginIdentifierValueMap incognito_value_map_; |
| 125 | 123 |
| 126 NotifyObserversCallback notify_callback_; | 124 NotifyObserversCallback notify_callback_; |
| 127 | 125 |
| 128 // Used around accesses to the value map objects to guarantee thread safety. | 126 // Used around accesses to the value map objects to guarantee thread safety. |
| 129 mutable base::Lock lock_; | 127 mutable base::Lock lock_; |
| 130 | 128 |
| 131 base::ThreadChecker thread_checker_; | 129 base::ThreadChecker thread_checker_; |
| 132 | 130 |
| 133 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); | 131 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 } // namespace content_settings | 134 } // namespace content_settings |
| 137 | 135 |
| 138 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 136 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
| OLD | NEW |