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

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

Issue 12189011: Split up chrome/browser/policy subdirectory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 10 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_CLOUD_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/prefs/public/pref_member.h"
13 #include "chrome/browser/policy/cloud_policy_constants.h"
14 #include "chrome/browser/policy/cloud_policy_core.h"
15 #include "chrome/browser/policy/cloud_policy_store.h"
16 #include "chrome/browser/policy/configuration_policy_provider.h"
17
18 namespace policy {
19
20 // CloudPolicyManager is the main switching central between cloud policy and the
21 // upper layers of the policy stack. It wires up a CloudPolicyCore to the
22 // ConfigurationPolicyProvider interface.
23 //
24 // This class contains the base functionality, there are subclasses that add
25 // functionality specific to user-level and device-level cloud policy, such as
26 // blocking on initial user policy fetch or device enrollment.
27 class CloudPolicyManager : public ConfigurationPolicyProvider,
28 public CloudPolicyStore::Observer {
29 public:
30 CloudPolicyManager(const PolicyNamespaceKey& policy_ns_key,
31 CloudPolicyStore* cloud_policy_store);
32 virtual ~CloudPolicyManager();
33
34 CloudPolicyCore* core() { return &core_; }
35 const CloudPolicyCore* core() const { return &core_; }
36
37 // ConfigurationPolicyProvider:
38 virtual void Shutdown() OVERRIDE;
39 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE;
40 virtual void RefreshPolicies() OVERRIDE;
41
42 // CloudPolicyStore::Observer:
43 virtual void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) OVERRIDE;
44 virtual void OnStoreError(CloudPolicyStore* cloud_policy_store) OVERRIDE;
45
46 protected:
47 // Check whether fully initialized and if so, publish policy by calling
48 // ConfigurationPolicyStore::UpdatePolicy().
49 void CheckAndPublishPolicy();
50
51 // Convenience accessors to core() components.
52 CloudPolicyClient* client() { return core_.client(); }
53 const CloudPolicyClient* client() const { return core_.client(); }
54 CloudPolicyStore* store() { return core_.store(); }
55 const CloudPolicyStore* store() const { return core_.store(); }
56 CloudPolicyService* service() { return core_.service(); }
57 const CloudPolicyService* service() const { return core_.service(); }
58
59 private:
60 // Completion handler for policy refresh operations.
61 void OnRefreshComplete(bool success);
62
63 CloudPolicyCore core_;
64
65 // Whether there's a policy refresh operation pending, in which case all
66 // policy update notifications are deferred until after it completes.
67 bool waiting_for_policy_refresh_;
68
69 DISALLOW_COPY_AND_ASSIGN(CloudPolicyManager);
70 };
71
72 } // namespace policy
73
74 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698