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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual void ShutdownOnUIThread() OVERRIDE; | 50 virtual void ShutdownOnUIThread() OVERRIDE; |
51 | 51 |
52 // content::NotificationObserver implementation. | 52 // content::NotificationObserver implementation. |
53 virtual void Observe(int type, | 53 virtual void Observe(int type, |
54 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) OVERRIDE; | 55 const content::NotificationDetails& details) OVERRIDE; |
56 | 56 |
57 private: | 57 private: |
58 // Sets the fields of |settings| based on the values in |dictionary|. | 58 // Sets the fields of |settings| based on the values in |dictionary|. |
59 void GetSettingsFromDictionary(const base::DictionaryValue* dictionary, | 59 void GetSettingsFromDictionary(const base::DictionaryValue* dictionary, |
60 ContentSettings* settings); | 60 ContentSetting* settings); |
61 | 61 |
62 // Forces the default settings to be explicitly set instead of themselves | 62 // Forces the default settings to be explicitly set instead of themselves |
63 // being CONTENT_SETTING_DEFAULT. | 63 // being CONTENT_SETTING_DEFAULT. |
64 void ForceDefaultsToBeExplicit(); | 64 void ForceDefaultsToBeExplicit(); |
65 | 65 |
66 // Reads the default settings from the preferences service. If |overwrite| is | 66 // Reads the default settings from the preferences service. If |overwrite| is |
67 // true and the preference is missing, the local copy will be cleared as well. | 67 // true and the preference is missing, the local copy will be cleared as well. |
68 void ReadDefaultSettings(bool overwrite); | 68 void ReadDefaultSettings(bool overwrite); |
69 | 69 |
70 void MigrateObsoleteNotificationPref(); | 70 void MigrateObsoleteNotificationPref(); |
71 void MigrateObsoleteGeolocationPref(); | 71 void MigrateObsoleteGeolocationPref(); |
72 | 72 |
73 // Copies of the pref data, so that we can read it on the IO thread. | 73 // Copies of the pref data, so that we can read it on the IO thread. |
74 ContentSettings default_content_settings_; | 74 ContentSetting default_content_settings_[CONTENT_SETTINGS_NUM_TYPES]; |
75 | 75 |
76 PrefService* prefs_; | 76 PrefService* prefs_; |
77 | 77 |
78 // Whether this settings map is for an Incognito session. | 78 // Whether this settings map is for an Incognito session. |
79 bool is_incognito_; | 79 bool is_incognito_; |
80 | 80 |
81 // Used around accesses to the |default_content_settings_| object to guarantee | 81 // Used around accesses to the |default_content_settings_| object to guarantee |
82 // thread safety. | 82 // thread safety. |
83 mutable base::Lock lock_; | 83 mutable base::Lock lock_; |
84 | 84 |
85 PrefChangeRegistrar pref_change_registrar_; | 85 PrefChangeRegistrar pref_change_registrar_; |
86 | 86 |
87 // Whether we are currently updating preferences, this is used to ignore | 87 // Whether we are currently updating preferences, this is used to ignore |
88 // notifications from the preferences service that we triggered ourself. | 88 // notifications from the preferences service that we triggered ourself. |
89 bool updating_preferences_; | 89 bool updating_preferences_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(DefaultProvider); | 91 DISALLOW_COPY_AND_ASSIGN(DefaultProvider); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace content_settings | 94 } // namespace content_settings |
95 | 95 |
96 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ | 96 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DEFAULT_PROVIDER_H_ |
OLD | NEW |