| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 const std::string& hash, | 230 const std::string& hash, |
| 231 const std::string& data) { | 231 const std::string& data) { |
| 232 DCHECK(metadata_.find(policy) != metadata_.end()); | 232 DCHECK(metadata_.find(policy) != metadata_.end()); |
| 233 DCHECK_EQ(hash, metadata_[policy].hash); | 233 DCHECK_EQ(hash, metadata_[policy].hash); |
| 234 if (external_data_store_) | 234 if (external_data_store_) |
| 235 external_data_store_->Store(policy, hash, data); | 235 external_data_store_->Store(policy, hash, data); |
| 236 | 236 |
| 237 const FetchCallbackList& pending_callbacks = pending_downloads_[policy]; | 237 const FetchCallbackList& pending_callbacks = pending_downloads_[policy]; |
| 238 for (FetchCallbackList::const_iterator it = pending_callbacks.begin(); | 238 for (FetchCallbackList::const_iterator it = pending_callbacks.begin(); |
| 239 it != pending_callbacks.end(); ++it) { | 239 it != pending_callbacks.end(); ++it) { |
| 240 RunCallback(*it, base::WrapUnique(new std::string(data))); | 240 RunCallback(*it, base::MakeUnique<std::string>(data)); |
| 241 } | 241 } |
| 242 pending_downloads_.erase(policy); | 242 pending_downloads_.erase(policy); |
| 243 return true; | 243 return true; |
| 244 } | 244 } |
| 245 | 245 |
| 246 void CloudExternalDataManagerBase::Backend::Fetch( | 246 void CloudExternalDataManagerBase::Backend::Fetch( |
| 247 const std::string& policy, | 247 const std::string& policy, |
| 248 const ExternalDataFetcher::FetchCallback& callback) { | 248 const ExternalDataFetcher::FetchCallback& callback) { |
| 249 Metadata::const_iterator metadata = metadata_.find(policy); | 249 Metadata::const_iterator metadata = metadata_.find(policy); |
| 250 if (metadata == metadata_.end()) { | 250 if (metadata == metadata_.end()) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 max_external_data_size_for_testing = max_size; | 446 max_external_data_size_for_testing = max_size; |
| 447 } | 447 } |
| 448 | 448 |
| 449 void CloudExternalDataManagerBase::FetchAll() { | 449 void CloudExternalDataManagerBase::FetchAll() { |
| 450 DCHECK(CalledOnValidThread()); | 450 DCHECK(CalledOnValidThread()); |
| 451 backend_task_runner_->PostTask(FROM_HERE, base::Bind( | 451 backend_task_runner_->PostTask(FROM_HERE, base::Bind( |
| 452 &Backend::FetchAll, base::Unretained(backend_.get()))); | 452 &Backend::FetchAll, base::Unretained(backend_.get()))); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace policy | 455 } // namespace policy |
| OLD | NEW |