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 |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "base/string16.h" |
| 12 #include "base/values.h" |
| 13 #include "policy/configuration_policy_type.h" |
| 14 |
| 15 namespace policy { |
| 16 |
| 17 // Describes a policy's status on the client. |
| 18 struct PolicyStatusInfo { |
| 19 |
| 20 // Defines the possible sources a policy can have. |
| 21 enum PolicySourceType { |
| 22 USER, |
| 23 DEVICE, |
| 24 SOURCE_TYPE_UNDEFINED, |
| 25 }; |
| 26 |
| 27 // Defines the possible levels a policy can be operating on. |
| 28 enum PolicyLevel { |
| 29 MANDATORY, |
| 30 RECOMMENDED, |
| 31 LEVEL_UNDEFINED, |
| 32 }; |
| 33 |
| 34 // Defines the possible statuses a policy can have. |
| 35 enum PolicyStatus { |
| 36 ENFORCED, |
| 37 FAILED, |
| 38 STATUS_UNDEFINED, |
| 39 }; |
| 40 |
| 41 PolicyStatusInfo(); |
| 42 PolicyStatusInfo(const PolicyStatusInfo& rhs); |
| 43 PolicyStatusInfo(string16 name, |
| 44 PolicySourceType source_type, |
| 45 PolicyLevel level, |
| 46 Value* value, |
| 47 PolicyStatus status, |
| 48 string16 error_message); |
| 49 ~PolicyStatusInfo(); |
| 50 PolicyStatusInfo& operator=(const PolicyStatusInfo& rhs); |
| 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 |
| 86 } // namespace policy |
| 87 |
| 88 #endif // CHROME_BROWSER_POLICY_POLICY_STATUS_INFO_H_ |
OLD | NEW |