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 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h"
7 #include "base/location.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/sequenced_task_runner.h"
10 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h"
11 #include "components/policy/core/common/cloud/cloud_policy_store.h"
12 #include "components/policy/core/common/cloud/resource_cache.h"
18 const char kCacheKey
[] = "data";
22 UserCloudExternalDataManager::UserCloudExternalDataManager(
23 const GetChromePolicyDetailsCallback
& get_policy_details
,
24 scoped_refptr
<base::SequencedTaskRunner
> backend_task_runner
,
25 scoped_refptr
<base::SequencedTaskRunner
> io_task_runner
,
26 const base::FilePath
& cache_path
,
27 CloudPolicyStore
* policy_store
)
28 : CloudExternalDataManagerBase(get_policy_details
,
31 resource_cache_(new ResourceCache(cache_path
, backend_task_runner
)) {
32 SetPolicyStore(policy_store
);
33 SetExternalDataStore(make_scoped_ptr(new CloudExternalDataStore(
34 kCacheKey
, backend_task_runner
, resource_cache_
)));
37 UserCloudExternalDataManager::~UserCloudExternalDataManager() {
38 SetExternalDataStore(scoped_ptr
<CloudExternalDataStore
>());
39 backend_task_runner_
->DeleteSoon(FROM_HERE
, resource_cache_
);