| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/policy_error_map.h" | 5 #include "chrome/browser/policy/policy_error_map.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const std::string& replacement) { | 50 const std::string& replacement) { |
| 51 AddError(PendingError(policy, message_id, ASCIIToUTF16(replacement))); | 51 AddError(PendingError(policy, message_id, ASCIIToUTF16(replacement))); |
| 52 } | 52 } |
| 53 | 53 |
| 54 string16 PolicyErrorMap::GetErrors(ConfigurationPolicyType policy) { | 54 string16 PolicyErrorMap::GetErrors(ConfigurationPolicyType policy) { |
| 55 CheckReadyAndConvert(); | 55 CheckReadyAndConvert(); |
| 56 std::pair<const_iterator, const_iterator> range = map_.equal_range(policy); | 56 std::pair<const_iterator, const_iterator> range = map_.equal_range(policy); |
| 57 std::vector<string16> list; | 57 std::vector<string16> list; |
| 58 for (const_iterator it = range.first; it != range.second; ++it) | 58 for (const_iterator it = range.first; it != range.second; ++it) |
| 59 list.push_back(it->second); | 59 list.push_back(it->second); |
| 60 return JoinString(list, ' '); | 60 return JoinString(list, '\n'); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool PolicyErrorMap::empty() { | 63 bool PolicyErrorMap::empty() { |
| 64 CheckReadyAndConvert(); | 64 CheckReadyAndConvert(); |
| 65 return map_.empty(); | 65 return map_.empty(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 size_t PolicyErrorMap::size() { | 68 size_t PolicyErrorMap::size() { |
| 69 CheckReadyAndConvert(); | 69 CheckReadyAndConvert(); |
| 70 return map_.size(); | 70 return map_.size(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 void PolicyErrorMap::CheckReadyAndConvert() { | 105 void PolicyErrorMap::CheckReadyAndConvert() { |
| 106 DCHECK(IsReady()); | 106 DCHECK(IsReady()); |
| 107 for (size_t i = 0; i < pending_.size(); ++i) { | 107 for (size_t i = 0; i < pending_.size(); ++i) { |
| 108 Convert(pending_[i]); | 108 Convert(pending_[i]); |
| 109 } | 109 } |
| 110 pending_.clear(); | 110 pending_.clear(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace policy | 113 } // namespace policy |
| OLD | NEW |