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#include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" 6 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" 13 14namespace policy { 15 16namespace { 17 18const char kCacheKey[] = "data"; 19 20} // namespace 21 22UserCloudExternalDataManager::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, 29 backend_task_runner, 30 io_task_runner), 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_))); 35} 36 37UserCloudExternalDataManager::~UserCloudExternalDataManager() { 38 SetExternalDataStore(scoped_ptr<CloudExternalDataStore>()); 39 backend_task_runner_->DeleteSoon(FROM_HERE, resource_cache_); 40} 41 42} // namespace policy 43