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_status_info.h" | 5 #include "chrome/browser/policy/policy_status_info.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 status(status), | 39 status(status), |
40 error_message(error_message) { | 40 error_message(error_message) { |
41 } | 41 } |
42 | 42 |
43 PolicyStatusInfo::~PolicyStatusInfo() { | 43 PolicyStatusInfo::~PolicyStatusInfo() { |
44 } | 44 } |
45 | 45 |
46 DictionaryValue* PolicyStatusInfo::GetDictionaryValue() const { | 46 DictionaryValue* PolicyStatusInfo::GetDictionaryValue() const { |
47 string16 level_string = GetPolicyLevelString(level); | 47 string16 level_string = GetPolicyLevelString(level); |
48 string16 source_type_string = GetSourceTypeString(source_type); | 48 string16 source_type_string = GetSourceTypeString(source_type); |
49 string16 status_message = status == ENFORCED ? ASCIIToUTF16("ok") | 49 string16 status_message = status == ENFORCED ? ASCIIToUTF16("OK") |
Mattias Nissler (ping if slow)
2011/10/28 15:18:51
Can we use IDS_OK here?
Joao da Silva
2011/10/28 15:45:00
Done.
| |
50 : error_message; | 50 : error_message; |
51 DictionaryValue* result = new DictionaryValue(); | 51 DictionaryValue* result = new DictionaryValue(); |
52 result->SetString(std::string(kNameDictPath), name); | 52 result->SetString(std::string(kNameDictPath), name); |
53 result->SetString(std::string(kLevelDictPath), level_string); | 53 result->SetString(std::string(kLevelDictPath), level_string); |
54 result->SetString(std::string(kSourceTypeDictPath), source_type_string); | 54 result->SetString(std::string(kSourceTypeDictPath), source_type_string); |
55 result->Set(std::string(kValueDictPath), value->DeepCopy()); | 55 result->Set(std::string(kValueDictPath), value->DeepCopy()); |
56 result->SetBoolean(std::string(kSetDictPath), level != LEVEL_UNDEFINED); | 56 result->SetBoolean(std::string(kSetDictPath), level != LEVEL_UNDEFINED); |
57 result->SetString(std::string(kStatusDictPath), status_message); | 57 result->SetString(std::string(kStatusDictPath), status_message); |
58 | 58 |
59 return result; | 59 return result; |
(...skipping 17 matching lines...) Expand all Loading... | |
77 } | 77 } |
78 | 78 |
79 // static | 79 // static |
80 string16 PolicyStatusInfo::GetPolicyLevelString(PolicyLevel level) { | 80 string16 PolicyStatusInfo::GetPolicyLevelString(PolicyLevel level) { |
81 static const char* strings[] = { "mandatory", "recommended", "undefined" }; | 81 static const char* strings[] = { "mandatory", "recommended", "undefined" }; |
82 DCHECK(static_cast<size_t>(level) < arraysize(strings)); | 82 DCHECK(static_cast<size_t>(level) < arraysize(strings)); |
83 return ASCIIToUTF16(strings[level]); | 83 return ASCIIToUTF16(strings[level]); |
84 } | 84 } |
85 | 85 |
86 } // namespace policy | 86 } // namespace policy |
OLD | NEW |