| 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_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 16 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 17 #include "chrome/browser/policy/cloud_policy_service.h" |
| 17 #include "chrome/browser/policy/cloud_policy_store.h" | 18 #include "chrome/browser/policy/cloud_policy_store.h" |
| 18 #include "chrome/browser/policy/device_local_account_policy_store.h" | 19 #include "chrome/browser/policy/device_local_account_policy_store.h" |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 class SessionManagerClient; | 22 class SessionManagerClient; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace policy { | 25 namespace policy { |
| 25 | 26 |
| 26 class CloudPolicyClient; | 27 class CloudPolicyClient; |
| 27 class CloudPolicyRefreshScheduler; | 28 class CloudPolicyRefreshScheduler; |
| 28 class CloudPolicyService; | |
| 29 class DeviceManagementService; | 29 class DeviceManagementService; |
| 30 | 30 |
| 31 // This class manages the policy settings for a single device-local account, | 31 // This class manages the policy settings for a single device-local account, |
| 32 // hosting the corresponding DeviceLocalAccountPolicyStore as well as the | 32 // hosting the corresponding DeviceLocalAccountPolicyStore as well as the |
| 33 // CloudPolicyClient (for updating the policy from the cloud) if applicable. | 33 // CloudPolicyClient (for updating the policy from the cloud) if applicable. |
| 34 class DeviceLocalAccountPolicyBroker { | 34 class DeviceLocalAccountPolicyBroker { |
| 35 public: | 35 public: |
| 36 DeviceLocalAccountPolicyBroker( | 36 DeviceLocalAccountPolicyBroker( |
| 37 const std::string& account_id, | 37 const std::string& account_id, |
| 38 chromeos::SessionManagerClient* session_manager_client, | 38 chromeos::SessionManagerClient* session_manager_client, |
| 39 chromeos::DeviceSettingsService* device_settings_service); | 39 chromeos::DeviceSettingsService* device_settings_service); |
| 40 ~DeviceLocalAccountPolicyBroker(); | 40 ~DeviceLocalAccountPolicyBroker(); |
| 41 | 41 |
| 42 CloudPolicyStore* store() { return &store_; } | 42 CloudPolicyStore* store() { return &store_; } |
| 43 const CloudPolicyStore* store() const { return &store_; } | 43 const CloudPolicyStore* store() const { return &store_; } |
| 44 | 44 |
| 45 CloudPolicyClient* client() { return client_.get(); } | 45 CloudPolicyClient* client() { return client_.get(); } |
| 46 const CloudPolicyClient* client() const { return client_.get(); } | 46 const CloudPolicyClient* client() const { return client_.get(); } |
| 47 | 47 |
| 48 const std::string& account_id() const { return account_id_; } | 48 const std::string& account_id() const { return account_id_; } |
| 49 | 49 |
| 50 // Refreshes policy (if applicable) and invokes |callback| when done. | 50 // Refreshes policy (if applicable) and invokes |callback| when done. |
| 51 void RefreshPolicy(const base::Closure& callback); | 51 void RefreshPolicy(const CloudPolicyService::RefreshPolicyCallback& callback); |
| 52 | 52 |
| 53 // Establish a cloud connection for the service. | 53 // Establish a cloud connection for the service. |
| 54 void Connect(scoped_ptr<CloudPolicyClient> client); | 54 void Connect(scoped_ptr<CloudPolicyClient> client); |
| 55 | 55 |
| 56 // Destroy the cloud connection, stopping policy refreshes. | 56 // Destroy the cloud connection, stopping policy refreshes. |
| 57 void Disconnect(); | 57 void Disconnect(); |
| 58 | 58 |
| 59 // Updates the refresh scheduler's delay from the key::kPolicyRefreshRate | 59 // Updates the refresh scheduler's delay from the key::kPolicyRefreshRate |
| 60 // policy in |store_|. | 60 // policy in |store_|. |
| 61 void UpdateRefreshDelay(); | 61 void UpdateRefreshDelay(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 PolicyBrokerMap policy_brokers_; | 152 PolicyBrokerMap policy_brokers_; |
| 153 | 153 |
| 154 ObserverList<Observer, true> observers_; | 154 ObserverList<Observer, true> observers_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyService); | 156 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyService); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace policy | 159 } // namespace policy |
| 160 | 160 |
| 161 #endif // CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 161 #endif // CHROME_BROWSER_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| OLD | NEW |