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> | |
|
joth
2011/09/05 11:09:38
not used?
| |
| 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 | |
| 51 // Returns a DictionaryValue pointer containing the information in the object | |
| 52 // for UI purposes. The caller acquires ownership of the returned value. | |
| 53 DictionaryValue* GetDictionaryValue() const; | |
| 54 | |
| 55 // Returns true if this PolicyStatusInfo object and |other_info| have equal | |
| 56 // contents and false otherwise. | |
| 57 bool Equals(const PolicyStatusInfo* other_info) const; | |
| 58 | |
| 59 // Returns the string corresponding to the PolicySourceType enum value | |
| 60 // |source_type|. | |
| 61 static string16 GetSourceTypeString(PolicySourceType source_type); | |
| 62 | |
| 63 // Returns the string corresponding to the PolicyLevel enum value |level|. | |
| 64 static string16 GetPolicyLevelString(PolicyLevel level); | |
| 65 | |
| 66 // The name of the policy. | |
| 67 string16 name; | |
| 68 | |
| 69 // The source type of the policy (user, device or undefined). | |
| 70 PolicySourceType source_type; | |
| 71 | |
| 72 // The level of the policy (mandatory, recommended or undefined). | |
| 73 PolicyLevel level; | |
| 74 | |
| 75 // The policy value. | |
| 76 scoped_ptr<Value> value; | |
| 77 | |
| 78 // The policy status (details whether the policy was successfully enforced). | |
| 79 PolicyStatus status; | |
| 80 | |
| 81 // An error message in cases where the policy could not be enforced. | |
| 82 string16 error_message; | |
| 83 | |
| 84 // Paths for the DictionaryValue returned by GetDictionaryValue(). | |
| 85 static const std::string kLevelDictPath; | |
| 86 static const std::string kNameDictPath; | |
| 87 static const std::string kSetDictPath; | |
| 88 static const std::string kSourceTypeDictPath; | |
| 89 static const std::string kStatusDictPath; | |
| 90 static const std::string kValueDictPath; | |
|
joth
2011/09/05 11:09:38
note static class instances are not allowed in sty
| |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(PolicyStatusInfo); | |
| 93 }; | |
| 94 | |
| 95 } // namespace policy | |
| 96 | |
| 97 #endif // CHROME_BROWSER_POLICY_POLICY_STATUS_INFO_H_ | |
| OLD | NEW |