| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ |
| 7 | 7 |
| 8 // A content setting provider that is set by the custodian of a supervised user. | 8 // A content setting provider that is set by the custodian of a supervised user. |
| 9 | 9 |
| 10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "components/content_settings/core/browser/content_settings_binary_value
_map.h" | 13 #include "components/content_settings/core/browser/content_settings_global_value
_map.h" |
| 14 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" | 14 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" |
| 15 | 15 |
| 16 class SupervisedUserSettingsService; | 16 class SupervisedUserSettingsService; |
| 17 | 17 |
| 18 namespace content_settings { | 18 namespace content_settings { |
| 19 | 19 |
| 20 // SupervisedProvider that provides content-settings managed by the custodian | 20 // SupervisedProvider that provides content-settings managed by the custodian |
| 21 // of a supervised user. | 21 // of a supervised user. |
| 22 class SupervisedProvider : public ObservableProvider { | 22 class SupervisedProvider : public ObservableProvider { |
| 23 public: | 23 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, | 34 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
| 35 const ContentSettingsPattern& secondary_pattern, | 35 const ContentSettingsPattern& secondary_pattern, |
| 36 ContentSettingsType content_type, | 36 ContentSettingsType content_type, |
| 37 const ResourceIdentifier& resource_identifier, | 37 const ResourceIdentifier& resource_identifier, |
| 38 base::Value* value) override; | 38 base::Value* value) override; |
| 39 | 39 |
| 40 void ClearAllContentSettingsRules(ContentSettingsType content_type) override; | 40 void ClearAllContentSettingsRules(ContentSettingsType content_type) override; |
| 41 | 41 |
| 42 void ShutdownOnUIThread() override; | 42 void ShutdownOnUIThread() override; |
| 43 | 43 |
| 44 private: |
| 44 // Callback on receiving settings from the supervised user settings service. | 45 // Callback on receiving settings from the supervised user settings service. |
| 45 void OnSupervisedSettingsAvailable(const base::DictionaryValue* settings); | 46 void OnSupervisedSettingsAvailable(const base::DictionaryValue* settings); |
| 46 | 47 |
| 47 private: | 48 GlobalValueMap value_map_; |
| 48 BinaryValueMap value_map_; | |
| 49 | 49 |
| 50 // Used around accesses to the |value_map_| object to guarantee | 50 // Used around accesses to the |value_map_| object to guarantee |
| 51 // thread safety. | 51 // thread safety. |
| 52 mutable base::Lock lock_; | 52 mutable base::Lock lock_; |
| 53 | 53 |
| 54 std::unique_ptr< | 54 std::unique_ptr< |
| 55 base::CallbackList<void(const base::DictionaryValue*)>::Subscription> | 55 base::CallbackList<void(const base::DictionaryValue*)>::Subscription> |
| 56 user_settings_subscription_; | 56 user_settings_subscription_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(SupervisedProvider); | 58 DISALLOW_COPY_AND_ASSIGN(SupervisedProvider); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace content_settings | 61 } // namespace content_settings |
| 62 | 62 |
| 63 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_
H_ | 63 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_
H_ |
| OLD | NEW |