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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/policy/configuration_policy_provider.h" | 12 #include "chrome/browser/policy/configuration_policy_provider.h" |
13 #include "chrome/browser/policy/policy_status_info.h" | 13 #include "chrome/browser/policy/policy_status_info.h" |
| 14 #include "policy/configuration_policy_type.h" |
14 | 15 |
15 namespace policy { | 16 namespace policy { |
16 | 17 |
17 class ConfigurationPolicyStatusKeeper; | 18 class ConfigurationPolicyStatusKeeper; |
18 | 19 |
19 // This class reads policy information from a ConfigurationPolicyProvider in | 20 // This class reads policy information from a ConfigurationPolicyProvider in |
20 // order to determine the status of a policy (this includes its value and | 21 // order to determine the status of a policy (this includes its value and |
21 // whether it could be enforced on the client or not), as required by the | 22 // whether it could be enforced on the client or not), as required by the |
22 // about:policy UI. | 23 // about:policy UI. |
23 class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { | 24 class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
24 public: | 25 public: |
25 | 26 |
26 // Observer class for the ConfigurationPolicyReader. Observer objects are | 27 // Observer class for the ConfigurationPolicyReader. Observer objects are |
27 // notified when policy values have changed. | 28 // notified when policy values have changed. |
28 class Observer { | 29 class Observer { |
29 public: | 30 public: |
30 // Called on an observer when the policy values have changed. | 31 // Called on an observer when the policy values have changed. |
31 virtual void OnPolicyValuesChanged() = 0; | 32 virtual void OnPolicyValuesChanged() = 0; |
32 | 33 |
33 protected: | 34 protected: |
34 virtual ~Observer() {} | 35 virtual ~Observer() {} |
35 }; | 36 }; |
36 | 37 |
37 ConfigurationPolicyReader(ConfigurationPolicyProvider* provider, | 38 ConfigurationPolicyReader(ConfigurationPolicyProvider* provider, |
38 PolicyStatusInfo::PolicyLevel policy_level); | 39 PolicyStatusInfo::PolicyLevel policy_level); |
39 virtual ~ConfigurationPolicyReader(); | 40 virtual ~ConfigurationPolicyReader(); |
40 | 41 |
41 // ConfigurationPolicyProvider::Observer methods: | 42 // ConfigurationPolicyProvider::Observer methods: |
42 virtual void OnUpdatePolicy(); | 43 virtual void OnUpdatePolicy() OVERRIDE; |
43 virtual void OnProviderGoingAway(); | 44 virtual void OnProviderGoingAway() OVERRIDE; |
44 | 45 |
45 // Methods to handle Observers. |observer| must be non-NULL. | 46 // Methods to handle Observers. |observer| must be non-NULL. |
46 void AddObserver(Observer* observer); | 47 void AddObserver(Observer* observer); |
47 void RemoveObserver(Observer* observer); | 48 void RemoveObserver(Observer* observer); |
48 | 49 |
49 // Creates a ConfigurationPolicyReader that reads managed platform policy. | 50 // Creates a ConfigurationPolicyReader that reads managed platform policy. |
50 static ConfigurationPolicyReader* CreateManagedPlatformPolicyReader(); | 51 static ConfigurationPolicyReader* CreateManagedPlatformPolicyReader(); |
51 | 52 |
52 // Creates a ConfigurationPolicyReader that reads managed cloud policy. | 53 // Creates a ConfigurationPolicyReader that reads managed cloud policy. |
53 static ConfigurationPolicyReader* CreateManagedCloudPolicyReader(); | 54 static ConfigurationPolicyReader* CreateManagedCloudPolicyReader(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 scoped_ptr<ConfigurationPolicyReader> managed_cloud_; | 135 scoped_ptr<ConfigurationPolicyReader> managed_cloud_; |
135 scoped_ptr<ConfigurationPolicyReader> recommended_platform_; | 136 scoped_ptr<ConfigurationPolicyReader> recommended_platform_; |
136 scoped_ptr<ConfigurationPolicyReader> recommended_cloud_; | 137 scoped_ptr<ConfigurationPolicyReader> recommended_cloud_; |
137 | 138 |
138 DISALLOW_COPY_AND_ASSIGN(PolicyStatus); | 139 DISALLOW_COPY_AND_ASSIGN(PolicyStatus); |
139 }; | 140 }; |
140 | 141 |
141 } // namespace policy | 142 } // namespace policy |
142 | 143 |
143 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ | 144 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
OLD | NEW |