| Index: chrome/browser/chromeos/policy/device_local_account_external_data_manager.h
|
| diff --git a/chrome/browser/chromeos/policy/device_local_account_external_data_manager.h b/chrome/browser/chromeos/policy/device_local_account_external_data_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..68edd01cd30a14432dbc8fdbf5b25d10ce38547a
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/policy/device_local_account_external_data_manager.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MANAGER_H_
|
| +#define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MANAGER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h"
|
| +
|
| +namespace base {
|
| +class SequencedTaskRunner;
|
| +}
|
| +
|
| +namespace policy {
|
| +
|
| +struct PolicyDefinitionList;
|
| +class ResourceCache;
|
| +
|
| +// Downloads, verifies, caches and retrieves external data referenced by
|
| +// policies.
|
| +// This is the implementation for device-local accounts on Chrome OS.
|
| +// The manager is created by the DeviceLocalAccountExternalDataService and must
|
| +// not outlive it because the |resource_cache| is owned by the service. However,
|
| +// the service is not the manager's sole owner: The manager lives as long as
|
| +// either the service or a DeviceLocalAccountPolicyProvider references it. This
|
| +// is necessary because a device-local account can be removed from policy (thus
|
| +// removing it from the service) while a session is in progress and a provider
|
| +// exists for the account. The manager is only destroyed when neither service
|
| +// nor provider reference it anymore.
|
| +class DeviceLocalAccountExternalDataManager
|
| + : public CloudExternalDataManagerBase,
|
| + public base::RefCounted<DeviceLocalAccountExternalDataManager> {
|
| + private:
|
| + friend class DeviceLocalAccountExternalDataService;
|
| + friend class base::RefCounted<DeviceLocalAccountExternalDataManager>;
|
| +
|
| + // The |policy_definitions| are used to determine the maximum size that the
|
| + // data referenced by each policy can have. Download scheduling, verification,
|
| + // caching and retrieval tasks are done via the |backend_task_runner|, which
|
| + // must support file I/O. Network I/O is done via the |io_task_runner|. The
|
| + // manager is responsible for external data references by policies in
|
| + // |policy_store|. Downloaded external data is stored in the |resource_cache|.
|
| + // The data is keyed by |account_id|, allowing one cache to be shared by any
|
| + // number of accounts. To ensure synchronization of operations on the shared
|
| + // cache, all its users must access the cache via |backend_task_runner| only.
|
| + DeviceLocalAccountExternalDataManager(
|
| + const std::string& account_id,
|
| + const PolicyDefinitionList* policy_definitions,
|
| + scoped_refptr<base::SequencedTaskRunner> backend_task_runner,
|
| + scoped_refptr<base::SequencedTaskRunner> io_task_runner,
|
| + ResourceCache* resource_cache);
|
| + virtual ~DeviceLocalAccountExternalDataManager();
|
| +
|
| + // CloudExternalDataManagerBase:
|
| + virtual void OnPolicyStoreLoaded() OVERRIDE;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataManager);
|
| +};
|
| +
|
| +} // namespace policy
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA_MANAGER_H_
|
|
|