| 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 "components/policy/core/browser/policy_error_map.h" | 5 #include "components/policy/core/browser/policy_error_map.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 const std::string& message) { | 179 const std::string& message) { |
| 180 AddError(new SchemaValidatingPendingError(policy, error_path, message)); | 180 AddError(new SchemaValidatingPendingError(policy, error_path, message)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 base::string16 PolicyErrorMap::GetErrors(const std::string& policy) { | 183 base::string16 PolicyErrorMap::GetErrors(const std::string& policy) { |
| 184 CheckReadyAndConvert(); | 184 CheckReadyAndConvert(); |
| 185 std::pair<const_iterator, const_iterator> range = map_.equal_range(policy); | 185 std::pair<const_iterator, const_iterator> range = map_.equal_range(policy); |
| 186 std::vector<base::string16> list; | 186 std::vector<base::string16> list; |
| 187 for (const_iterator it = range.first; it != range.second; ++it) | 187 for (const_iterator it = range.first; it != range.second; ++it) |
| 188 list.push_back(it->second); | 188 list.push_back(it->second); |
| 189 return base::JoinString(list, base::ASCIIToUTF16("\n")); | 189 return JoinString(list, '\n'); |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool PolicyErrorMap::empty() { | 192 bool PolicyErrorMap::empty() { |
| 193 CheckReadyAndConvert(); | 193 CheckReadyAndConvert(); |
| 194 return map_.empty(); | 194 return map_.empty(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 size_t PolicyErrorMap::size() { | 197 size_t PolicyErrorMap::size() { |
| 198 CheckReadyAndConvert(); | 198 CheckReadyAndConvert(); |
| 199 return map_.size(); | 199 return map_.size(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 229 | 229 |
| 230 void PolicyErrorMap::CheckReadyAndConvert() { | 230 void PolicyErrorMap::CheckReadyAndConvert() { |
| 231 DCHECK(IsReady()); | 231 DCHECK(IsReady()); |
| 232 for (size_t i = 0; i < pending_.size(); ++i) { | 232 for (size_t i = 0; i < pending_.size(); ++i) { |
| 233 Convert(pending_[i]); | 233 Convert(pending_[i]); |
| 234 } | 234 } |
| 235 pending_.clear(); | 235 pending_.clear(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace policy | 238 } // namespace policy |
| OLD | NEW |