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_CONFIGURATION_POLICY_READER_H_ | |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/scoped_ptr.h" | |
| 10 #include "base/values.h" | |
| 11 #include "chrome/browser/policy/configuration_policy_provider.h" | |
| 12 #include "chrome/browser/policy/policy_status_map.h" | |
| 13 | |
| 14 namespace policy { | |
| 15 | |
| 16 class ConfigurationPolicyStatusKeeper; | |
| 17 | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
Need a class description here.
simo
2011/08/10 14:28:19
Done.
| |
| 18 class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { | |
| 19 public: | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
indentation is one space for visibility labels onl
simo
2011/08/10 14:28:19
Done.
| |
| 20 | |
| 21 bool IsInitializationComplete() const; | |
| 22 | |
| 23 virtual ~ConfigurationPolicyReader(); | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
Move destructor declaration before other members.
simo
2011/08/10 14:28:19
Done.
| |
| 24 | |
| 25 // ConfigurationPolicyProvider::Observer methods: | |
| 26 virtual void OnUpdatePolicy(); | |
| 27 virtual void OnProviderGoingAway(); | |
| 28 | |
| 29 // Creates a ConfigurationPolicyPrefStore that reads managed platform | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
It's not a PrefStore.
simo
2011/08/10 14:28:19
Done.
| |
| 30 // policy. | |
| 31 static ConfigurationPolicyReader* | |
| 32 CreateManagedPlatformPolicyReader(bool managed); | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
What does the managed parameter do?
simo
2011/08/10 14:28:19
I have changed this now to be a PolicyStatusInfo::
| |
| 33 | |
| 34 // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. | |
| 35 static ConfigurationPolicyReader* | |
| 36 CreateManagedCloudPolicyReader(bool managed); | |
| 37 | |
| 38 // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
Comments says managed while name says recommended?
simo
2011/08/10 14:28:19
Done.
| |
| 39 static ConfigurationPolicyReader* | |
| 40 CreateRecommendedPlatformPolicyReader(bool managed); | |
| 41 | |
| 42 // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. | |
| 43 static ConfigurationPolicyReader* | |
| 44 CreateRecommendedCloudPolicyReader(bool managed); | |
| 45 | |
| 46 // Returns a pointer to a DictionaryValue object containing policy status | |
| 47 // information for the UI. Ownership of the return value is acquired by the | |
| 48 // caller. Returns NULL if the reader is not aware of the given policy. | |
| 49 DictionaryValue* GetPolicyStatus(ConfigurationPolicyType policy) const; | |
| 50 | |
| 51 private: | |
| 52 explicit ConfigurationPolicyReader(ConfigurationPolicyProvider* provider, | |
| 53 bool managed); | |
| 54 | |
| 55 void Refresh(); | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
document
simo
2011/08/10 14:28:19
Done.
| |
| 56 | |
| 57 // The policy provider from which policy settings are read. | |
| 58 ConfigurationPolicyProvider* provider_; | |
| 59 | |
| 60 bool initialization_complete_; | |
| 61 | |
| 62 // Whether this ConfigurationPolicyReader contains managed policies. | |
| 63 bool managed_policies_; | |
| 64 | |
| 65 // Current policy status. | |
| 66 scoped_ptr<ConfigurationPolicyStatusKeeper> policy_keeper_; | |
| 67 | |
| 68 ConfigurationPolicyObserverRegistrar registrar_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyReader); | |
| 71 }; | |
| 72 | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
class comment.
simo
2011/08/10 14:28:19
Done.
| |
| 73 class PolicyStatus { | |
| 74 | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
remove newline
simo
2011/08/10 14:28:19
Done.
| |
| 75 public: | |
| 76 PolicyStatus(); | |
| 77 ~PolicyStatus(); | |
| 78 | |
| 79 // Returns a ListValue pointer containing the status information of all | |
| 80 // policies supported by the client. This is for the about:policy UI to | |
| 81 // display | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
missing period.
simo
2011/08/10 14:28:19
Done.
| |
| 82 ListValue* GetPolicyStatusList() const; | |
| 83 | |
| 84 private: | |
| 85 typedef ConfigurationPolicyProvider::PolicyDefinitionList | |
| 86 PolicyDefinitionList; | |
| 87 | |
| 88 // Add the policy information for |policy| to the ListValue pointed to be | |
| 89 // |list| as it is returned by the different ConfigurationPolicyReader | |
| 90 // objects. Returns true if a policy was added and false otherwise. | |
| 91 bool AddPolicyFromReaders(ConfigurationPolicyType policy, | |
| 92 ListValue* list) const; | |
| 93 | |
| 94 scoped_ptr<ConfigurationPolicyReader> managed_platform_; | |
| 95 scoped_ptr<ConfigurationPolicyReader> managed_cloud_; | |
| 96 scoped_ptr<ConfigurationPolicyReader> recommended_platform_; | |
| 97 scoped_ptr<ConfigurationPolicyReader> recommended_cloud_; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(PolicyStatus); | |
| 100 }; | |
| 101 | |
| 102 } // policy | |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
should be "namespace policy"
simo
2011/08/10 14:28:19
Done.
| |
| 103 | |
| 104 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ | |
| OLD | NEW |