OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MANAGE
R_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MANAGE
R_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
| 14 |
| 15 namespace base { |
| 16 class SequencedTaskRunner; |
| 17 } |
| 18 |
| 19 namespace policy { |
| 20 |
| 21 struct PolicyDefinitionList; |
| 22 class ResourceCache; |
| 23 |
| 24 // Downloads, verifies, caches and retrieves external data referenced by |
| 25 // policies. |
| 26 // This is the implementation for device-local accounts on Chrome OS. |
| 27 // The manager is created by the DeviceLocalAccountExternalDataService and must |
| 28 // not outlive it because the |resource_cache| is owned by the service. However, |
| 29 // the service is not the manager's sole owner: The manager lives as long as |
| 30 // either the service or a DeviceLocalAccountPolicyProvider references it. This |
| 31 // is necessary because a device-local account can be removed from policy (thus |
| 32 // removing it from the service) while a session is in progress and a provider |
| 33 // exists for the account. The manager is only destroyed when neither service |
| 34 // nor provider reference it anymore. |
| 35 class DeviceLocalAccountExternalDataManager |
| 36 : public CloudExternalDataManagerBase, |
| 37 public base::RefCounted<DeviceLocalAccountExternalDataManager> { |
| 38 private: |
| 39 friend class DeviceLocalAccountExternalDataService; |
| 40 friend class base::RefCounted<DeviceLocalAccountExternalDataManager>; |
| 41 |
| 42 // The |policy_definitions| are used to determine the maximum size that the |
| 43 // data referenced by each policy can have. Download scheduling, verification, |
| 44 // caching and retrieval tasks are done via the |backend_task_runner|, which |
| 45 // must support file I/O. Network I/O is done via the |io_task_runner|. The |
| 46 // manager is responsible for external data references by policies in |
| 47 // |policy_store|. Downloaded external data is stored in the |resource_cache|. |
| 48 // The data is keyed by |account_id|, allowing one cache to be shared by any |
| 49 // number of accounts. To ensure synchronization of operations on the shared |
| 50 // cache, all its users must access the cache via |backend_task_runner| only. |
| 51 DeviceLocalAccountExternalDataManager( |
| 52 const std::string& account_id, |
| 53 const PolicyDefinitionList* policy_definitions, |
| 54 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, |
| 55 scoped_refptr<base::SequencedTaskRunner> io_task_runner, |
| 56 ResourceCache* resource_cache); |
| 57 virtual ~DeviceLocalAccountExternalDataManager(); |
| 58 |
| 59 // CloudExternalDataManagerBase: |
| 60 virtual void OnPolicyStoreLoaded() OVERRIDE; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataManager); |
| 63 }; |
| 64 |
| 65 } // namespace policy |
| 66 |
| 67 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MAN
AGER_H_ |
OLD | NEW |