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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVICE_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/chromeos/policy/device_local_account_external_data_manager.h"
16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
17 #include "components/policy/core/common/cloud/resource_cache.h"
20 class SequencedTaskRunner
;
25 class CloudPolicyStore
;
27 // Provides DeviceLocalAccountExternalDataManagers for all device-local
28 // accounts. This class owns the |resource_cache_| that the managers share.
29 class DeviceLocalAccountExternalDataService
30 : public DeviceLocalAccountPolicyService::Observer
{
32 DeviceLocalAccountExternalDataService(
33 DeviceLocalAccountPolicyService
* parent
,
34 scoped_refptr
<base::SequencedTaskRunner
> backend_task_runner
,
35 scoped_refptr
<base::SequencedTaskRunner
> io_task_runner
);
36 ~DeviceLocalAccountExternalDataService() override
;
38 // DeviceLocalAccountPolicyService::Observer:
39 void OnPolicyUpdated(const std::string
& user_id
) override
;
40 void OnDeviceLocalAccountsChanged() override
;
42 scoped_refptr
<DeviceLocalAccountExternalDataManager
>
43 GetExternalDataManager(const std::string
& account_id
,
44 CloudPolicyStore
* policy_store
);
47 typedef std::map
<std::string
,
48 scoped_refptr
<DeviceLocalAccountExternalDataManager
> >
49 ExternalDataManagerMap
;
51 DeviceLocalAccountPolicyService
* parent_
;
52 scoped_refptr
<base::SequencedTaskRunner
> backend_task_runner_
;
53 scoped_refptr
<base::SequencedTaskRunner
> io_task_runner_
;
54 scoped_ptr
<ResourceCache
> resource_cache_
;
56 ExternalDataManagerMap external_data_managers_
;
58 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataService
);
63 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_SERVICE_H_