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_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVIC
E_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVIC
E_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVIC
E_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVIC
E_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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" | 15 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" |
16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
17 #include "components/policy/core/common/cloud/resource_cache.h" | 17 #include "components/policy/core/common/cloud/resource_cache.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
21 } | 21 } |
22 | 22 |
| 23 namespace user_manager { |
| 24 class UserID; |
| 25 } |
| 26 |
23 namespace policy { | 27 namespace policy { |
24 | 28 |
25 class CloudPolicyStore; | 29 class CloudPolicyStore; |
26 | 30 |
27 // Provides DeviceLocalAccountExternalDataManagers for all device-local | 31 // Provides DeviceLocalAccountExternalDataManagers for all device-local |
28 // accounts. This class owns the |resource_cache_| that the managers share. | 32 // accounts. This class owns the |resource_cache_| that the managers share. |
29 class DeviceLocalAccountExternalDataService | 33 class DeviceLocalAccountExternalDataService |
30 : public DeviceLocalAccountPolicyService::Observer { | 34 : public DeviceLocalAccountPolicyService::Observer { |
31 public: | 35 public: |
32 DeviceLocalAccountExternalDataService( | 36 DeviceLocalAccountExternalDataService( |
33 DeviceLocalAccountPolicyService* parent, | 37 DeviceLocalAccountPolicyService* parent, |
34 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, | 38 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, |
35 scoped_refptr<base::SequencedTaskRunner> io_task_runner); | 39 scoped_refptr<base::SequencedTaskRunner> io_task_runner); |
36 ~DeviceLocalAccountExternalDataService() override; | 40 ~DeviceLocalAccountExternalDataService() override; |
37 | 41 |
38 // DeviceLocalAccountPolicyService::Observer: | 42 // DeviceLocalAccountPolicyService::Observer: |
39 void OnPolicyUpdated(const std::string& user_id) override; | 43 void OnPolicyUpdated(const user_manager::UserID& user_id) override; |
40 void OnDeviceLocalAccountsChanged() override; | 44 void OnDeviceLocalAccountsChanged() override; |
41 | 45 |
42 scoped_refptr<DeviceLocalAccountExternalDataManager> | 46 scoped_refptr<DeviceLocalAccountExternalDataManager> |
43 GetExternalDataManager(const std::string& account_id, | 47 GetExternalDataManager(const std::string& account_id, |
44 CloudPolicyStore* policy_store); | 48 CloudPolicyStore* policy_store); |
45 | 49 |
46 private: | 50 private: |
47 typedef std::map<std::string, | 51 typedef std::map<std::string, |
48 scoped_refptr<DeviceLocalAccountExternalDataManager> > | 52 scoped_refptr<DeviceLocalAccountExternalDataManager> > |
49 ExternalDataManagerMap; | 53 ExternalDataManagerMap; |
50 | 54 |
51 DeviceLocalAccountPolicyService* parent_; | 55 DeviceLocalAccountPolicyService* parent_; |
52 scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; | 56 scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; |
53 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; | 57 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; |
54 scoped_ptr<ResourceCache> resource_cache_; | 58 scoped_ptr<ResourceCache> resource_cache_; |
55 | 59 |
56 ExternalDataManagerMap external_data_managers_; | 60 ExternalDataManagerMap external_data_managers_; |
57 | 61 |
58 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataService); | 62 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataService); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace policy | 65 } // namespace policy |
62 | 66 |
63 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SER
VICE_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SER
VICE_H_ |
OLD | NEW |