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

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

Issue 10449071: Enable user policy handling through the new cloud policy stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 6 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_USER_CLOUD_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/policy/cloud_policy_client.h"
12 #include "chrome/browser/policy/cloud_policy_constants.h"
13 #include "chrome/browser/policy/cloud_policy_store.h"
14 #include "chrome/browser/policy/configuration_policy_provider.h"
15
16 class PrefService;
17
18 namespace policy {
19
20 class CloudPolicyRefreshScheduler;
21 class CloudPolicyService;
22 class DeviceManagementService;
23
24 // UserCloudPolicyManager keeps track of all things user policy, drives the
25 // corresponding cloud policy service and publishes policy through the
26 // ConfigurationPolicyProvider interface.
27 class UserCloudPolicyManager : public ConfigurationPolicyProvider,
28 public CloudPolicyClient::Observer,
29 public CloudPolicyStore::Observer {
30 public:
31 // If |wait_for_policy| fetch is true, IsInitializationComplete() will return
32 // false as long as there hasn't been a successful policy fetch.
33 UserCloudPolicyManager(const PolicyDefinitionList* policy_list,
34 scoped_ptr<CloudPolicyStore> store,
35 bool wait_for_policy_fetch);
36 virtual ~UserCloudPolicyManager();
37
38 #if defined(OS_CHROMEOS)
39 // Creates a UserCloudPolicyService instance for the Chrome OS platform.
40 static scoped_ptr<UserCloudPolicyManager> Create(bool wait_for_policy_fetch);
41 #endif
42
43 // Initializes the cloud connection. |prefs| and |service| must stay valid
44 // until Shutdown() gets called.
45 void Initialize(PrefService* prefs,
46 DeviceManagementService* service,
47 UserAffiliation user_affiliation);
48 void Shutdown();
49
50 // Cancels waiting for the policy fetch and flags the
51 // ConfigurationPolicyProvider ready (assuming all other initialization tasks
52 // have completed).
53 void CancelWaitForPolicyFetch();
54
55 CloudPolicyService* cloud_policy_service() { return service_.get(); }
56
57 // ConfigurationPolicyProvider:
58 virtual bool IsInitializationComplete() const OVERRIDE;
59 virtual void RefreshPolicies() OVERRIDE;
60
61 // CloudPolicyClient::Observer:
62 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE;
63 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE;
64 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE;
65
66 // CloudPolicyStore::Observer:
67 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
68 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE;
69
70 private:
71 // Check whether fully initialized and if so, publish policy by calling
72 // ConfigurationPolicyStore::UpdatePolicy().
73 void CheckAndPublishPolicy();
74
75 // Completion handler for the explicit policy fetch triggered on startup in
76 // case |wait_for_policy_fetch_| is true.
77 void OnInitialPolicyFetchComplete();
78
79 // Completion handler for policy refresh operations.
80 void OnRefreshComplete();
81
82 // Whether to wait for a policy fetch to complete before reporting
83 // IsInitializationComplete().
84 bool wait_for_policy_fetch_;
85
86 // Whether there's a policy refresh operation pending, in which case all
87 // policy update notifications are deferred until after it completes.
88 bool wait_for_policy_refresh_;
89
90 scoped_ptr<CloudPolicyStore> store_;
91 scoped_ptr<CloudPolicyService> service_;
92 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_;
93
94 // The pref service to pass to the refresh scheduler on initialization.
95 PrefService* prefs_;
96
97 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager);
98 };
99
100 } // namespace policy
101
102 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/proxy_policy_provider_unittest.cc ('k') | chrome/browser/policy/user_cloud_policy_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698