Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_POLICY_STATUS_INFO_H_ | |
| 6 #define CHROME_BROWSER_POLICY_POLICY_STATUS_INFO_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/scoped_ptr.h" | |
| 12 #include "base/string16.h" | |
| 13 #include "base/values.h" | |
| 14 #include "policy/configuration_policy_type.h" | |
| 15 | |
| 16 namespace policy { | |
| 17 | |
| 18 // Describes a policy's status on the client. | |
| 19 struct PolicyStatusInfo { | |
| 20 | |
| 21 // Defines the possible sources a policy can have. | |
| 22 enum PolicySourceType { | |
| 23 USER, | |
| 24 DEVICE, | |
| 25 SOURCE_TYPE_UNDEFINED, | |
| 26 }; | |
| 27 | |
| 28 // Defines the possible levels a policy can be operating on. | |
| 29 enum PolicyLevel { | |
| 30 MANDATORY, | |
| 31 RECOMMENDED, | |
| 32 LEVEL_UNDEFINED, | |
| 33 }; | |
| 34 | |
| 35 // Defines the possible statuses a policy can have. | |
| 36 enum PolicyStatus { | |
| 37 ENFORCED, | |
| 38 FAILED, | |
| 39 STATUS_UNDEFINED, | |
| 40 }; | |
| 41 | |
| 42 PolicyStatusInfo(); | |
| 43 PolicyStatusInfo(string16 name, | |
| 44 PolicySourceType source_type, | |
| 45 PolicyLevel level, | |
| 46 Value* value, | |
| 47 PolicyStatus status, | |
| 48 string16 error_message); | |
| 49 ~PolicyStatusInfo(); | |
| 50 | |
|
Mattias Nissler (ping if slow)
2011/08/29 11:24:40
remove extra blank line
| |
| 51 | |
| 52 // Returns a DictionaryValue pointer containing the information in the object | |
| 53 // for UI purposes. The caller acquires ownership of the returned value. | |
| 54 DictionaryValue* GetDictionaryValue() const; | |
| 55 | |
| 56 // Returns true if this PolicyStatusInfo object and |other_info| have equal | |
| 57 // contents and false otherwise. | |
| 58 bool Equals(const PolicyStatusInfo* other_info) const; | |
| 59 | |
| 60 // Returns the string corresponding to the PolicySourceType enum value | |
| 61 // |source_type|. | |
| 62 static string16 GetSourceTypeString(PolicySourceType source_type); | |
| 63 | |
| 64 // Returns the string corresponding to the PolicyLevel enum value |level|. | |
| 65 static string16 GetPolicyLevelString(PolicyLevel level); | |
| 66 | |
| 67 // The name of the policy. | |
| 68 string16 name; | |
| 69 | |
| 70 // The source type of the policy (user, device or undefined). | |
| 71 PolicySourceType source_type; | |
| 72 | |
| 73 // The level of the policy (mandatory, recommended or undefined). | |
| 74 PolicyLevel level; | |
| 75 | |
| 76 // The policy value. | |
| 77 scoped_ptr<Value> value; | |
| 78 | |
| 79 // The policy status (details whether the policy was successfully enforced). | |
| 80 PolicyStatus status; | |
| 81 | |
| 82 // An error message in cases where the policy could not be enforced. | |
| 83 string16 error_message; | |
| 84 | |
| 85 // Paths for the DictionaryValue returned by GetDictionaryValue(). | |
| 86 static const std::string level_dict_path; | |
|
Mattias Nissler (ping if slow)
2011/08/29 11:24:40
These are constants and should thus be name kLevel
| |
| 87 static const std::string name_dict_path; | |
| 88 static const std::string set_dict_path; | |
| 89 static const std::string source_type_dict_path; | |
| 90 static const std::string status_dict_path; | |
| 91 static const std::string value_dict_path; | |
| 92 | |
| 93 DISALLOW_COPY_AND_ASSIGN(PolicyStatusInfo); | |
| 94 }; | |
| 95 | |
| 96 } // namespace policy | |
| 97 | |
| 98 #endif // CHROME_BROWSER_POLICY_POLICY_STATUS_INFO_H_ | |
| OLD | NEW |