OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INVALIDATOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // the main policy thread. | 65 // the main policy thread. |
66 // |clock| is used to get the current time. | 66 // |clock| is used to get the current time. |
67 // |highest_handled_invalidation_version| is the highest invalidation version | 67 // |highest_handled_invalidation_version| is the highest invalidation version |
68 // that was handled already before this invalidator was created. | 68 // that was handled already before this invalidator was created. |
69 CloudPolicyInvalidator( | 69 CloudPolicyInvalidator( |
70 enterprise_management::DeviceRegisterRequest::Type type, | 70 enterprise_management::DeviceRegisterRequest::Type type, |
71 CloudPolicyCore* core, | 71 CloudPolicyCore* core, |
72 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 72 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
73 scoped_ptr<base::Clock> clock, | 73 scoped_ptr<base::Clock> clock, |
74 int64 highest_handled_invalidation_version); | 74 int64 highest_handled_invalidation_version); |
75 virtual ~CloudPolicyInvalidator(); | 75 ~CloudPolicyInvalidator() override; |
76 | 76 |
77 // Initializes the invalidator. No invalidations will be generated before this | 77 // Initializes the invalidator. No invalidations will be generated before this |
78 // method is called. This method must only be called once. | 78 // method is called. This method must only be called once. |
79 // |invalidation_service| is the invalidation service to use and must remain | 79 // |invalidation_service| is the invalidation service to use and must remain |
80 // valid until Shutdown is called. | 80 // valid until Shutdown is called. |
81 void Initialize(invalidation::InvalidationService* invalidation_service); | 81 void Initialize(invalidation::InvalidationService* invalidation_service); |
82 | 82 |
83 // Shuts down and disables invalidations. It must be called before the object | 83 // Shuts down and disables invalidations. It must be called before the object |
84 // is destroyed. | 84 // is destroyed. |
85 void Shutdown(); | 85 void Shutdown(); |
86 | 86 |
87 // Whether the invalidator currently has the ability to receive invalidations. | 87 // Whether the invalidator currently has the ability to receive invalidations. |
88 bool invalidations_enabled() { | 88 bool invalidations_enabled() { |
89 return invalidations_enabled_; | 89 return invalidations_enabled_; |
90 } | 90 } |
91 | 91 |
92 // The highest invalidation version that was handled already. | 92 // The highest invalidation version that was handled already. |
93 int64 highest_handled_invalidation_version() const { | 93 int64 highest_handled_invalidation_version() const { |
94 return highest_handled_invalidation_version_; | 94 return highest_handled_invalidation_version_; |
95 } | 95 } |
96 | 96 |
97 // syncer::InvalidationHandler: | 97 // syncer::InvalidationHandler: |
98 virtual void OnInvalidatorStateChange( | 98 void OnInvalidatorStateChange(syncer::InvalidatorState state) override; |
99 syncer::InvalidatorState state) override; | 99 void OnIncomingInvalidation( |
100 virtual void OnIncomingInvalidation( | |
101 const syncer::ObjectIdInvalidationMap& invalidation_map) override; | 100 const syncer::ObjectIdInvalidationMap& invalidation_map) override; |
102 virtual std::string GetOwnerName() const override; | 101 std::string GetOwnerName() const override; |
103 | 102 |
104 // CloudPolicyCore::Observer: | 103 // CloudPolicyCore::Observer: |
105 virtual void OnCoreConnected(CloudPolicyCore* core) override; | 104 void OnCoreConnected(CloudPolicyCore* core) override; |
106 virtual void OnRefreshSchedulerStarted(CloudPolicyCore* core) override; | 105 void OnRefreshSchedulerStarted(CloudPolicyCore* core) override; |
107 virtual void OnCoreDisconnecting(CloudPolicyCore* core) override; | 106 void OnCoreDisconnecting(CloudPolicyCore* core) override; |
108 | 107 |
109 // CloudPolicyStore::Observer: | 108 // CloudPolicyStore::Observer: |
110 virtual void OnStoreLoaded(CloudPolicyStore* store) override; | 109 void OnStoreLoaded(CloudPolicyStore* store) override; |
111 virtual void OnStoreError(CloudPolicyStore* store) override; | 110 void OnStoreError(CloudPolicyStore* store) override; |
112 | 111 |
113 private: | 112 private: |
114 // Handle an invalidation to the policy. | 113 // Handle an invalidation to the policy. |
115 void HandleInvalidation(const syncer::Invalidation& invalidation); | 114 void HandleInvalidation(const syncer::Invalidation& invalidation); |
116 | 115 |
117 // Update object registration with the invalidation service based on the | 116 // Update object registration with the invalidation service based on the |
118 // given policy data. | 117 // given policy data. |
119 void UpdateRegistration(const enterprise_management::PolicyData* policy); | 118 void UpdateRegistration(const enterprise_management::PolicyData* policy); |
120 | 119 |
121 // Registers the given object with the invalidation service. | 120 // Registers the given object with the invalidation service. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 234 |
236 // WeakPtrFactory used to create callbacks to this object. | 235 // WeakPtrFactory used to create callbacks to this object. |
237 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_; | 236 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_; |
238 | 237 |
239 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); | 238 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); |
240 }; | 239 }; |
241 | 240 |
242 } // namespace policy | 241 } // namespace policy |
243 | 242 |
244 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ | 243 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
OLD | NEW |