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.
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_
8 // A content setting provider that is set by the custodian of a supervised user.
10 #include "base/callback_list.h"
11 #include "base/synchronization/lock.h"
12 #include "components/content_settings/core/browser/content_settings_binary_value_map.h"
13 #include "components/content_settings/core/browser/content_settings_observable_provider.h"
16 class SupervisedUserSettingsService
;
18 namespace content_settings
{
20 // SupervisedProvider that provides content-settings managed by the custodian
21 // of a supervised user.
22 class SupervisedProvider
: public ObservableProvider
{
24 explicit SupervisedProvider(
25 SupervisedUserSettingsService
* supervised_user_settings_service
);
26 ~SupervisedProvider() override
;
28 // ProviderInterface implementations.
29 RuleIterator
* GetRuleIterator(ContentSettingsType content_type
,
30 const ResourceIdentifier
& resource_identifier
,
31 bool incognito
) const override
;
33 bool SetWebsiteSetting(const ContentSettingsPattern
& primary_pattern
,
34 const ContentSettingsPattern
& secondary_pattern
,
35 ContentSettingsType content_type
,
36 const ResourceIdentifier
& resource_identifier
,
37 base::Value
* value
) override
;
39 void ClearAllContentSettingsRules(ContentSettingsType content_type
) override
;
41 void ShutdownOnUIThread() override
;
43 // Callback on receiving settings from the supervised user settings service.
44 void OnSupervisedSettingsAvailable(const base::DictionaryValue
* settings
);
47 BinaryValueMap value_map_
;
49 // Used around accesses to the |value_map_| object to guarantee
51 mutable base::Lock lock_
;
53 scoped_ptr
<base::CallbackList
<void(
54 const base::DictionaryValue
*)>::Subscription
> user_settings_subscription_
;
56 DISALLOW_COPY_AND_ASSIGN(SupervisedProvider
);
59 } // namespace content_settings
61 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_