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

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: Rebase. 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_service.h"
Joao da Silva 2012/06/01 12:27:47 CloudPolicyService can be forward-declared in this
Mattias Nissler (ping if slow) 2012/06/04 17:42:37 Done.
14 #include "chrome/browser/policy/cloud_policy_store.h"
15 #include "chrome/browser/policy/configuration_policy_provider.h"
16
17 class PrefService;
18
19 namespace chromeos {
20 class SessionManagerClient;
Joao da Silva 2012/06/01 12:27:47 Not needed
Mattias Nissler (ping if slow) 2012/06/04 17:42:37 Done.
21 }
22
23 namespace policy {
24
25 class CloudPolicyRefreshScheduler;
26 class DeviceManagementService;
27
28 // UserCloudPolicyManager keeps track of all things user policy, drives the
29 // corresponding cloud policy service and publishes policy through the
30 // ConfigurationPolicyProvider interface.
31 class UserCloudPolicyManager : public ConfigurationPolicyProvider,
32 public CloudPolicyClient::Observer,
33 public CloudPolicyStore::Observer {
34 public:
35 // If |wait_for_policy| fetch is true, IsInitializationComplete() will return
36 // false as long as there hasn't been a successful policy fetch.
37 UserCloudPolicyManager(const PolicyDefinitionList* policy_list,
38 scoped_ptr<CloudPolicyStore> store,
39 bool wait_for_policy_fetch);
40 virtual ~UserCloudPolicyManager();
41
42 // Initializes the cloud connection. |prefs| and |service| must stay valid
43 // until Shutdown() gets called.
44 void Initialize(PrefService* prefs,
45 DeviceManagementService* service,
46 UserAffiliation user_affiliation);
47 void Shutdown();
48
49 // Cancels waiting for the policy fetch and flags the
50 // ConfigurationPolicyProvider ready (assuming all other initialization tasks
51 // have completed).
52 void CancelWaitForPolicyFetch();
53
54 CloudPolicyService* cloud_policy_service() { return service_.get(); }
Joao da Silva 2012/06/01 12:27:47 const method?
Mattias Nissler (ping if slow) 2012/06/04 17:42:37 You mean a const variant of the getter? Let's add
Joao da Silva 2012/06/05 07:21:46 I mean that this method can be const: CloudPolicy
55
56 // ConfigurationPolicyProvider:
57 virtual bool IsInitializationComplete() const OVERRIDE;
58 virtual void RefreshPolicies() OVERRIDE;
59
60 // CloudPolicyClient::Observer:
61 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE;
62 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE;
63 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE;
64
65 // CloudPolicyStore::Observer:
66 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
67 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE;
68
69 #if defined(OS_CHROMEOS)
70 // Creates a UserCloudPolicyService instance for the Chrome OS platform.
71 static scoped_ptr<UserCloudPolicyManager> Create(bool wait_for_policy_fetch);
72 #endif
Joao da Silva 2012/06/01 12:27:47 Put this declaration after the dtor, to preserve t
Mattias Nissler (ping if slow) 2012/06/04 17:42:37 Done.
73
74 private:
75 // Check whether fully initialized and if so, publish policy by calling
76 // ConfigurationPolicyStore::UpdatePolicy().
77 void CheckAndPublishPolicy();
78
79 // Completion handler for the explicit policy fetch triggered on startup in
80 // case |wait_for_policy_fetch_| is true.
81 void OnInitialPolicyFetchComplete();
82
83 // Completion handler for policy refresh operations.
84 void OnRefreshComplete();
85
86 // Whether to wait for a policy fetch to complete before reporting
87 // IsInitializationComplete().
88 bool wait_for_policy_fetch_;
89
90 // Whether there's a policy refresh operation pending, in which case all
91 // policy update notifications are deferred until after it completes.
92 bool wait_for_policy_refresh_;
93
94 scoped_ptr<CloudPolicyStore> store_;
95 scoped_ptr<CloudPolicyService> service_;
96 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_;
97
98 // The pref service to pass to the refresh scheduler on initialization.
99 PrefService* prefs_;
100
101 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager);
102 };
103
104 } // namespace policy
105
106 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698