1 // Copyright 2013 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_CHROMEOS_POLICY_LOGIN_PROFILE_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_PROFILE_POLICY_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "components/policy/core/common/configuration_policy_provider.h"
12 #include "components/policy/core/common/policy_service.h"
16 // Policy provider for the login profile. Since the login profile is not
17 // associated with any user, it does not receive regular user policy. However,
18 // several device policies that control features on the login screen surface as
19 // user policies in the login profile.
20 class LoginProfilePolicyProvider
: public ConfigurationPolicyProvider
,
21 public PolicyService::Observer
{
23 explicit LoginProfilePolicyProvider(PolicyService
* device_policy_service
);
24 ~LoginProfilePolicyProvider() override
;
26 // ConfigurationPolicyProvider:
27 void Init(SchemaRegistry
* registry
) override
;
28 void Shutdown() override
;
29 void RefreshPolicies() override
;
31 // PolicyService::Observer:
32 void OnPolicyUpdated(const PolicyNamespace
& ns
,
33 const PolicyMap
& previous
,
34 const PolicyMap
& current
) override
;
35 void OnPolicyServiceInitialized(PolicyDomain domain
) override
;
37 void OnDevicePolicyRefreshDone();
40 void UpdateFromDevicePolicy();
42 PolicyService
* device_policy_service_
; // Not owned.
44 bool waiting_for_device_policy_refresh_
;
46 base::WeakPtrFactory
<LoginProfilePolicyProvider
> weak_factory_
;
48 DISALLOW_COPY_AND_ASSIGN(LoginProfilePolicyProvider
);
53 #endif // CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_PROFILE_POLICY_PROVIDER_H_