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

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

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/prefs/pref_member.h" 12 #include "base/prefs/pref_member.h"
13 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 13 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
14 #include "chrome/browser/policy/cloud/cloud_policy_core.h" 14 #include "chrome/browser/policy/cloud/cloud_policy_core.h"
15 #include "chrome/browser/policy/cloud/cloud_policy_store.h" 15 #include "chrome/browser/policy/cloud/cloud_policy_store.h"
16 #include "chrome/browser/policy/configuration_policy_provider.h" 16 #include "chrome/browser/policy/configuration_policy_provider.h"
17 17
18 namespace invalidation {
19 class InvalidationService;
20 }
21
18 namespace policy { 22 namespace policy {
19 23
24 class CloudPolicyInvalidator;
20 class PolicyBundle; 25 class PolicyBundle;
21 26
22 // CloudPolicyManager is the main switching central between cloud policy and the 27 // CloudPolicyManager is the main switching central between cloud policy and the
23 // upper layers of the policy stack. It wires up a CloudPolicyCore to the 28 // upper layers of the policy stack. It wires up a CloudPolicyCore to the
24 // ConfigurationPolicyProvider interface. 29 // ConfigurationPolicyProvider interface.
25 // 30 //
26 // This class contains the base functionality, there are subclasses that add 31 // This class contains the base functionality, there are subclasses that add
27 // functionality specific to user-level and device-level cloud policy, such as 32 // functionality specific to user-level and device-level cloud policy, such as
28 // blocking on initial user policy fetch or device enrollment. 33 // blocking on initial user policy fetch or device enrollment.
29 class CloudPolicyManager : public ConfigurationPolicyProvider, 34 class CloudPolicyManager : public ConfigurationPolicyProvider,
(...skipping 13 matching lines...) Expand all
43 48
44 // CloudPolicyStore::Observer: 49 // CloudPolicyStore::Observer:
45 virtual void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) OVERRIDE; 50 virtual void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) OVERRIDE;
46 virtual void OnStoreError(CloudPolicyStore* cloud_policy_store) OVERRIDE; 51 virtual void OnStoreError(CloudPolicyStore* cloud_policy_store) OVERRIDE;
47 52
48 protected: 53 protected:
49 // Check whether fully initialized and if so, publish policy by calling 54 // Check whether fully initialized and if so, publish policy by calling
50 // ConfigurationPolicyStore::UpdatePolicy(). 55 // ConfigurationPolicyStore::UpdatePolicy().
51 void CheckAndPublishPolicy(); 56 void CheckAndPublishPolicy();
52 57
58 // Enable policy invalidations to be received by creating the invalidator
59 // object. The refresh scheduler must be started before calling this method.
60 // |service| is the invalidation service to use and must remain valid until
61 // Shutdown or UnregisterInvalidator is called.
62 void CreateInvalidator(invalidation::InvalidationService* service);
63
64 // Causes the invalidator to unregister with the invalidation service and then
65 // destroys the invalidator. This method should only be called when policy is
66 // no longer applied; it should not be called for normal browser shutdown.
67 // This method has no effect if CreateInvalidator has not been called.
68 void UnregisterInvalidator();
69
53 // Called by CheckAndPublishPolicy() to create a bundle with the current 70 // Called by CheckAndPublishPolicy() to create a bundle with the current
54 // policies. 71 // policies.
55 virtual scoped_ptr<PolicyBundle> CreatePolicyBundle(); 72 virtual scoped_ptr<PolicyBundle> CreatePolicyBundle();
56 73
57 // Convenience accessors to core() components. 74 // Convenience accessors to core() components.
58 CloudPolicyClient* client() { return core_.client(); } 75 CloudPolicyClient* client() { return core_.client(); }
59 const CloudPolicyClient* client() const { return core_.client(); } 76 const CloudPolicyClient* client() const { return core_.client(); }
60 CloudPolicyStore* store() { return core_.store(); } 77 CloudPolicyStore* store() { return core_.store(); }
61 const CloudPolicyStore* store() const { return core_.store(); } 78 const CloudPolicyStore* store() const { return core_.store(); }
62 CloudPolicyService* service() { return core_.service(); } 79 CloudPolicyService* service() { return core_.service(); }
63 const CloudPolicyService* service() const { return core_.service(); } 80 const CloudPolicyService* service() const { return core_.service(); }
64 81
65 private: 82 private:
66 // Completion handler for policy refresh operations. 83 // Completion handler for policy refresh operations.
67 void OnRefreshComplete(bool success); 84 void OnRefreshComplete(bool success);
68 85
69 CloudPolicyCore core_; 86 CloudPolicyCore core_;
70 87
71 // Whether there's a policy refresh operation pending, in which case all 88 // Whether there's a policy refresh operation pending, in which case all
72 // policy update notifications are deferred until after it completes. 89 // policy update notifications are deferred until after it completes.
73 bool waiting_for_policy_refresh_; 90 bool waiting_for_policy_refresh_;
74 91
92 // The policy invalidator, which handles invalidations to the policy.
93 scoped_ptr<CloudPolicyInvalidator> invalidator_;
94
75 DISALLOW_COPY_AND_ASSIGN(CloudPolicyManager); 95 DISALLOW_COPY_AND_ASSIGN(CloudPolicyManager);
76 }; 96 };
77 97
78 } // namespace policy 98 } // namespace policy
79 99
80 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_ 100 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698