Chromium Code Reviews| Index: chrome/browser/policy/configuration_policy_reader.h |
| diff --git a/chrome/browser/policy/configuration_policy_reader.h b/chrome/browser/policy/configuration_policy_reader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..522a2ff3c951826baaed1c9e0bdaed1c46892ce7 |
| --- /dev/null |
| +++ b/chrome/browser/policy/configuration_policy_reader.h |
| @@ -0,0 +1,104 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
| +#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
| +#pragma once |
| + |
| +#include "base/scoped_ptr.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/policy/configuration_policy_provider.h" |
| +#include "chrome/browser/policy/policy_status_map.h" |
| + |
| +namespace policy { |
| + |
| +class ConfigurationPolicyStatusKeeper; |
| + |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
Need a class description here.
simo
2011/08/10 14:28:19
Done.
|
| +class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
| + 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.
|
| + |
| + bool IsInitializationComplete() const; |
| + |
| + 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.
|
| + |
| + // ConfigurationPolicyProvider::Observer methods: |
| + virtual void OnUpdatePolicy(); |
| + virtual void OnProviderGoingAway(); |
| + |
| + // 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.
|
| + // policy. |
| + static ConfigurationPolicyReader* |
| + 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::
|
| + |
| + // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. |
| + static ConfigurationPolicyReader* |
| + CreateManagedCloudPolicyReader(bool managed); |
| + |
| + // 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.
|
| + static ConfigurationPolicyReader* |
| + CreateRecommendedPlatformPolicyReader(bool managed); |
| + |
| + // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. |
| + static ConfigurationPolicyReader* |
| + CreateRecommendedCloudPolicyReader(bool managed); |
| + |
| + // Returns a pointer to a DictionaryValue object containing policy status |
| + // information for the UI. Ownership of the return value is acquired by the |
| + // caller. Returns NULL if the reader is not aware of the given policy. |
| + DictionaryValue* GetPolicyStatus(ConfigurationPolicyType policy) const; |
| + |
| + private: |
| + explicit ConfigurationPolicyReader(ConfigurationPolicyProvider* provider, |
| + bool managed); |
| + |
| + void Refresh(); |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
document
simo
2011/08/10 14:28:19
Done.
|
| + |
| + // The policy provider from which policy settings are read. |
| + ConfigurationPolicyProvider* provider_; |
| + |
| + bool initialization_complete_; |
| + |
| + // Whether this ConfigurationPolicyReader contains managed policies. |
| + bool managed_policies_; |
| + |
| + // Current policy status. |
| + scoped_ptr<ConfigurationPolicyStatusKeeper> policy_keeper_; |
| + |
| + ConfigurationPolicyObserverRegistrar registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyReader); |
| +}; |
| + |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
class comment.
simo
2011/08/10 14:28:19
Done.
|
| +class PolicyStatus { |
| + |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
remove newline
simo
2011/08/10 14:28:19
Done.
|
| + public: |
| + PolicyStatus(); |
| + ~PolicyStatus(); |
| + |
| + // Returns a ListValue pointer containing the status information of all |
| + // policies supported by the client. This is for the about:policy UI to |
| + // display |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
missing period.
simo
2011/08/10 14:28:19
Done.
|
| + ListValue* GetPolicyStatusList() const; |
| + |
| + private: |
| + typedef ConfigurationPolicyProvider::PolicyDefinitionList |
| + PolicyDefinitionList; |
| + |
| + // Add the policy information for |policy| to the ListValue pointed to be |
| + // |list| as it is returned by the different ConfigurationPolicyReader |
| + // objects. Returns true if a policy was added and false otherwise. |
| + bool AddPolicyFromReaders(ConfigurationPolicyType policy, |
| + ListValue* list) const; |
| + |
| + scoped_ptr<ConfigurationPolicyReader> managed_platform_; |
| + scoped_ptr<ConfigurationPolicyReader> managed_cloud_; |
| + scoped_ptr<ConfigurationPolicyReader> recommended_platform_; |
| + scoped_ptr<ConfigurationPolicyReader> recommended_cloud_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PolicyStatus); |
| +}; |
| + |
| +} // policy |
|
Mattias Nissler (ping if slow)
2011/08/09 13:20:40
should be "namespace policy"
simo
2011/08/10 14:28:19
Done.
|
| + |
| +#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |