Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_POLICY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_ | 6 #define CHROME_BROWSER_POLICY_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/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/policy/cloud_policy_store.h" | 13 #include "chrome/browser/policy/cloud_policy_store.h" |
| 14 #include "chrome/browser/policy/configuration_policy_provider.h" | 14 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 15 | 15 |
| 16 class PrefService; | 16 class PrefService; |
| 17 | 17 |
| 18 namespace policy { | 18 namespace policy { |
| 19 | 19 |
| 20 class CloudPolicyClient; | 20 class CloudPolicyClient; |
| 21 class CloudPolicyRefreshScheduler; | 21 class CloudPolicyRefreshScheduler; |
| 22 class CloudPolicyService; | 22 class CloudPolicyService; |
| 23 | 23 |
| 24 // CloudPolicyManager is the main switching central between cloud policy and the | 24 // CloudPolicyManager is the main switching central between cloud policy and the |
| 25 // upper layers of the policy stack. It owns CloudPolicyStore, | 25 // upper layers of the policy stack. It CloudPolicyClient and |
|
Andrew T Wilson (Slow)
2012/11/23 15:04:20
It -> It owns
Mattias Nissler (ping if slow)
2012/11/23 17:36:06
Done.
| |
| 26 // CloudPolicyClient, and CloudPolicyService, is responsible for receiving and | 26 // CloudPolicyService, is responsible for receiving and keeping policy from the |
| 27 // keeping policy from the cloud and exposes the decoded policy via the | 27 // cloud and exposes the decoded policy from a CloudPolicyStore via the |
| 28 // ConfigurationPolicyProvider interface. | 28 // ConfigurationPolicyProvider interface. |
| 29 // | 29 // |
| 30 // This class contains the base functionality, there are subclasses that add | 30 // This class contains the base functionality, there are subclasses that add |
| 31 // functionality specific to user-level and device-level cloud policy, such as | 31 // functionality specific to user-level and device-level cloud policy, such as |
| 32 // blocking on initial user policy fetch or device enrollment. | 32 // blocking on initial user policy fetch or device enrollment. |
| 33 class CloudPolicyManager : public ConfigurationPolicyProvider, | 33 class CloudPolicyManager : public ConfigurationPolicyProvider, |
| 34 public CloudPolicyStore::Observer { | 34 public CloudPolicyStore::Observer { |
| 35 public: | 35 public: |
| 36 explicit CloudPolicyManager(scoped_ptr<CloudPolicyStore> store); | 36 explicit CloudPolicyManager(CloudPolicyStore* store); |
| 37 virtual ~CloudPolicyManager(); | 37 virtual ~CloudPolicyManager(); |
| 38 | 38 |
| 39 CloudPolicyClient* cloud_policy_client() { return client_.get(); } | 39 CloudPolicyClient* cloud_policy_client() { return client_.get(); } |
| 40 const CloudPolicyClient* cloud_policy_client() const { return client_.get(); } | 40 const CloudPolicyClient* cloud_policy_client() const { return client_.get(); } |
| 41 | 41 |
| 42 CloudPolicyStore* cloud_policy_store() { return store_.get(); } | 42 CloudPolicyStore* cloud_policy_store() { return store_; } |
| 43 const CloudPolicyStore* cloud_policy_store() const { return store_.get(); } | 43 const CloudPolicyStore* cloud_policy_store() const { return store_; } |
| 44 | 44 |
| 45 CloudPolicyService* cloud_policy_service() { return service_.get(); } | 45 CloudPolicyService* cloud_policy_service() { return service_.get(); } |
| 46 const CloudPolicyService* cloud_policy_service() const { | 46 const CloudPolicyService* cloud_policy_service() const { |
| 47 return service_.get(); | 47 return service_.get(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // ConfigurationPolicyProvider: | 50 // ConfigurationPolicyProvider: |
| 51 virtual void Shutdown() OVERRIDE; | 51 virtual void Shutdown() OVERRIDE; |
| 52 virtual bool IsInitializationComplete() const OVERRIDE; | 52 virtual bool IsInitializationComplete() const OVERRIDE; |
| 53 virtual void RefreshPolicies() OVERRIDE; | 53 virtual void RefreshPolicies() OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 69 const std::string& refresh_rate_pref); | 69 const std::string& refresh_rate_pref); |
| 70 | 70 |
| 71 // Check whether fully initialized and if so, publish policy by calling | 71 // Check whether fully initialized and if so, publish policy by calling |
| 72 // ConfigurationPolicyStore::UpdatePolicy(). | 72 // ConfigurationPolicyStore::UpdatePolicy(). |
| 73 void CheckAndPublishPolicy(); | 73 void CheckAndPublishPolicy(); |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 // Completion handler for policy refresh operations. | 76 // Completion handler for policy refresh operations. |
| 77 void OnRefreshComplete(); | 77 void OnRefreshComplete(); |
| 78 | 78 |
| 79 scoped_ptr<CloudPolicyStore> store_; | 79 CloudPolicyStore* store_; |
| 80 scoped_ptr<CloudPolicyClient> client_; | 80 scoped_ptr<CloudPolicyClient> client_; |
| 81 scoped_ptr<CloudPolicyService> service_; | 81 scoped_ptr<CloudPolicyService> service_; |
| 82 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_; | 82 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_; |
| 83 | 83 |
| 84 // Whether there's a policy refresh operation pending, in which case all | 84 // Whether there's a policy refresh operation pending, in which case all |
| 85 // policy update notifications are deferred until after it completes. | 85 // policy update notifications are deferred until after it completes. |
| 86 bool waiting_for_policy_refresh_; | 86 bool waiting_for_policy_refresh_; |
| 87 | 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(CloudPolicyManager); | 88 DISALLOW_COPY_AND_ASSIGN(CloudPolicyManager); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace policy | 91 } // namespace policy |
| 92 | 92 |
| 93 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_ | 93 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_MANAGER_H_ |
| OLD | NEW |