| 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_store.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "base/sha1.h" | 11 #include "base/sha1.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "chrome/browser/policy/cloud/resource_cache.h" | 13 #include "components/policy/core/common/cloud/resource_cache.h" |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Encodes (policy, hash) into a single string. | 19 // Encodes (policy, hash) into a single string. |
| 20 std::string GetSubkey(const std::string& policy, const std::string& hash) { | 20 std::string GetSubkey(const std::string& policy, const std::string& hash) { |
| 21 DCHECK(!policy.empty()); | 21 DCHECK(!policy.empty()); |
| 22 DCHECK(!hash.empty()); | 22 DCHECK(!hash.empty()); |
| 23 return base::IntToString(policy.size()) + ":" + | 23 return base::IntToString(policy.size()) + ":" + |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return true; | 69 return true; |
| 70 // If the data is larger than allowed or does not match the expected hash, | 70 // If the data is larger than allowed or does not match the expected hash, |
| 71 // delete the entry. | 71 // delete the entry. |
| 72 cache_->Delete(cache_key_, subkey); | 72 cache_->Delete(cache_key_, subkey); |
| 73 data->clear(); | 73 data->clear(); |
| 74 } | 74 } |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace policy | 78 } // namespace policy |
| OLD | NEW |