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 "components/policy/core/common/cloud/cloud_external_data_manager.h" 6 7 #include "components/policy/core/common/cloud/cloud_policy_store.h" 8 #include "net/url_request/url_request_context_getter.h" 9 10 namespace policy { 11 12 CloudExternalDataManager::MetadataEntry::MetadataEntry() { 13 } 14 15 CloudExternalDataManager::MetadataEntry::MetadataEntry(const std::string& url, 16 const std::string& hash) 17 : url(url), 18 hash(hash) { 19 } 20 21 bool CloudExternalDataManager::MetadataEntry::operator!=( 22 const MetadataEntry& other) const { 23 return url != other.url || hash != other.hash; 24 } 25 26 CloudExternalDataManager::CloudExternalDataManager() : policy_store_(NULL), 27 weak_factory_(this) { 28 } 29 30 CloudExternalDataManager::~CloudExternalDataManager() { 31 } 32 33 void CloudExternalDataManager::SetPolicyStore(CloudPolicyStore* policy_store) { 34 weak_factory_.InvalidateWeakPtrs(); 35 policy_store_ = policy_store; 36 if (policy_store_) 37 policy_store_->SetExternalDataManager(weak_factory_.GetWeakPtr()); 38 } 39 40 } // namespace policy 41