Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/policy/device_local_account_policy_provider.h

Issue 12189011: Split up chrome/browser/policy subdirectory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, add chrome/browser/chromeos/policy/OWNERS Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/policy/configuration_policy_provider.h"
14 #include "chrome/browser/policy/device_local_account_policy_service.h"
15
16 namespace policy {
17
18 // Policy provider for a device-local account. Pulls policy from
19 // DeviceLocalAccountPolicyService. Note that this implementation keeps
20 // functioning when the device-local account disappears from
21 // DeviceLocalAccountPolicyService. The current policy will be kept in that case
22 // and RefreshPolicies becomes a no-op.
23 class DeviceLocalAccountPolicyProvider
24 : public ConfigurationPolicyProvider,
25 public DeviceLocalAccountPolicyService::Observer {
26 public:
27 DeviceLocalAccountPolicyProvider(const std::string& account_id,
28 DeviceLocalAccountPolicyService* service);
29 virtual ~DeviceLocalAccountPolicyProvider();
30
31 // ConfigurationPolicyProvider:
32 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE;
33 virtual void RefreshPolicies() OVERRIDE;
34
35 // DeviceLocalAccountPolicyService::Observer:
36 virtual void OnPolicyUpdated(const std::string& account_id) OVERRIDE;
37 virtual void OnDeviceLocalAccountsChanged() OVERRIDE;
38
39 private:
40 // Returns the broker for |account_id_| or NULL if not available.
41 DeviceLocalAccountPolicyBroker* GetBroker();
42
43 // Handles completion of policy refreshes and triggers the update callback.
44 // |success| is true if the policy refresh was successful.
45 void ReportPolicyRefresh(bool success);
46
47 // Unless |waiting_for_policy_refresh_|, calls UpdatePolicy(), using the
48 // policy from the broker if available or keeping the current policy.
49 void UpdateFromBroker();
50
51 const std::string account_id_;
52 DeviceLocalAccountPolicyService* service_;
53
54 bool store_initialized_;
55 bool waiting_for_policy_refresh_;
56
57 base::WeakPtrFactory<DeviceLocalAccountPolicyProvider> weak_factory_;
58
59 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyProvider);
60 };
61
62 } // namespace policy
63
64 #endif // CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698