OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_ |
| 7 |
| 8 // A content setting provider that is set by the custodian of a supervised user. |
| 9 |
| 10 #include "base/synchronization/lock.h" |
| 11 #include "components/content_settings/core/browser/content_settings_binary_value
_map.h" |
| 12 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" |
| 13 |
| 14 class PrefService; |
| 15 class SupervisedUserSettingsService; |
| 16 |
| 17 namespace content_settings { |
| 18 |
| 19 // SupervisedProvider that provides content-settings managed by the custodian |
| 20 // of a supervised user. |
| 21 class SupervisedProvider : public ObservableProvider { |
| 22 public: |
| 23 explicit SupervisedProvider( |
| 24 SupervisedUserSettingsService* supervised_user_settings_service); |
| 25 ~SupervisedProvider() override; |
| 26 |
| 27 // ProviderInterface implementations. |
| 28 RuleIterator* GetRuleIterator(ContentSettingsType content_type, |
| 29 const ResourceIdentifier& resource_identifier, |
| 30 bool incognito) const override; |
| 31 |
| 32 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
| 33 const ContentSettingsPattern& secondary_pattern, |
| 34 ContentSettingsType content_type, |
| 35 const ResourceIdentifier& resource_identifier, |
| 36 base::Value* value) override; |
| 37 |
| 38 void ClearAllContentSettingsRules(ContentSettingsType content_type) override; |
| 39 |
| 40 void ShutdownOnUIThread() override; |
| 41 |
| 42 // Callback on receiving settings from the supervised user settings service. |
| 43 void OnSupervisedSettingsAvailable(const base::DictionaryValue* settings); |
| 44 |
| 45 private: |
| 46 BinaryValueMap value_map_; |
| 47 |
| 48 // Used around accesses to the |value_map_| object to guarantee |
| 49 // thread safety. |
| 50 mutable base::Lock lock_; |
| 51 |
| 52 base::WeakPtrFactory<SupervisedProvider> weak_ptr_factory_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(SupervisedProvider); |
| 55 }; |
| 56 |
| 57 } // namespace content_settings |
| 58 |
| 59 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_
H_ |
OLD | NEW |