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/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_provider.h"
15 class SupervisedUserSettingsService
;
17 namespace content_settings
{
19 // SupervisedProvider that provides content-settings managed by the custodian
20 // of a supervised user.
21 class SupervisedProvider
: public ObservableProvider
{
23 explicit SupervisedProvider(
24 SupervisedUserSettingsService
* supervised_user_settings_service
);
25 ~SupervisedProvider() override
;
27 // ProviderInterface implementations.
28 RuleIterator
* GetRuleIterator(ContentSettingsType content_type
,
29 const ResourceIdentifier
& resource_identifier
,
30 bool incognito
) const override
;
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
;
38 void ClearAllContentSettingsRules(ContentSettingsType content_type
) override
;
40 void ShutdownOnUIThread() override
;
42 // Callback on receiving settings from the supervised user settings service.
43 void OnSupervisedSettingsAvailable(const base::DictionaryValue
* settings
);
46 BinaryValueMap value_map_
;
48 // Used around accesses to the |value_map_| object to guarantee
50 mutable base::Lock lock_
;
52 base::WeakPtrFactory
<SupervisedProvider
> weak_ptr_factory_
;
54 DISALLOW_COPY_AND_ASSIGN(SupervisedProvider
);
57 } // namespace content_settings
59 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_SUPERVISED_PROVIDER_H_