Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: chrome/browser/policy/configuration_policy_provider.h

Issue 4062002: Dynamic policy refresh support for the Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/map/list/, nits. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/scoped_ptr.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "chrome/browser/policy/configuration_policy_store.h" 15 #include "chrome/browser/policy/configuration_policy_store.h"
14 16
15 namespace policy { 17 namespace policy {
16 18
17 // A mostly-abstract super class for platform-specific policy providers. 19 // A mostly-abstract super class for platform-specific policy providers.
18 // Platform-specific policy providers (Windows Group Policy, gconf, 20 // Platform-specific policy providers (Windows Group Policy, gconf,
19 // etc.) should implement a subclass of this class. 21 // etc.) should implement a subclass of this class.
20 class ConfigurationPolicyProvider { 22 class ConfigurationPolicyProvider {
21 public: 23 public:
22 // Used for static arrays of policy values that is used to initialize an 24 // Used for static arrays of policy values that is used to initialize an
23 // instance of the ConfigurationPolicyProvider. 25 // instance of the ConfigurationPolicyProvider.
24 struct StaticPolicyValueMap { 26 struct PolicyDefinitionList {
25 struct Entry { 27 struct Entry {
26 ConfigurationPolicyStore::PolicyType policy_type; 28 ConfigurationPolicyStore::PolicyType policy_type;
27 Value::ValueType value_type; 29 Value::ValueType value_type;
28 const char* name; 30 const char* name;
29 }; 31 };
30 32
31 size_t entry_count; 33 const Entry* begin;
32 const Entry* entries; 34 const Entry* end;
33 }; 35 };
34 36
35 explicit ConfigurationPolicyProvider(const StaticPolicyValueMap& policy_map); 37 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list);
36 38
37 virtual ~ConfigurationPolicyProvider(); 39 virtual ~ConfigurationPolicyProvider();
38 40
39 // Must be implemented by provider subclasses to specify the 41 // Must be implemented by provider subclasses to specify the
40 // provider-specific policy decisions. The preference service 42 // provider-specific policy decisions. The preference service
41 // invokes this |Provide| method when it needs a policy 43 // invokes this |Provide| method when it needs a policy
42 // provider to specify its policy choices. In |Provide|, 44 // provider to specify its policy choices. In |Provide|,
43 // the |ConfigurationPolicyProvider| must make calls to the 45 // the |ConfigurationPolicyProvider| must make calls to the
44 // |Apply| method of |store| to apply specific policies. 46 // |Apply| method of |store| to apply specific policies.
45 // Returns true if the policy could be provided, otherwise false. 47 // Returns true if the policy could be provided, otherwise false.
46 virtual bool Provide(ConfigurationPolicyStore* store) = 0; 48 virtual bool Provide(ConfigurationPolicyStore* store) = 0;
47 49
48 // Called by the subclass provider at any time to indicate that the currently 50 // Called by the subclass provider at any time to indicate that the currently
49 // applied policy is not longer current. A policy refresh will be initiated as 51 // applied policy is not longer current. A policy refresh will be initiated as
50 // soon as possible. 52 // soon as possible.
51 virtual void NotifyStoreOfPolicyChange(); 53 virtual void NotifyStoreOfPolicyChange();
52 54
53 protected: 55 protected:
54 // A structure mapping policies to their implementations by providers. 56 const PolicyDefinitionList* policy_definition_list() const {
55 struct PolicyValueMapEntry { 57 return policy_definition_list_;
56 ConfigurationPolicyStore::PolicyType policy_type;
57 Value::ValueType value_type;
58 std::string name;
59 };
60 typedef std::vector<PolicyValueMapEntry> PolicyValueMap;
61
62 const PolicyValueMap& policy_value_map() const {
63 return policy_value_map_;
64 } 58 }
65 59
66 private: 60 private:
67 // Contains the default mapping from policy values to the actual names. 61 // Contains the default mapping from policy values to the actual names.
68 PolicyValueMap policy_value_map_; 62 const ConfigurationPolicyProvider::PolicyDefinitionList*
63 policy_definition_list_;
69 64
70 private: 65 private:
71 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); 66 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider);
72 }; 67 };
73 68
74 } // namespace policy 69 } // namespace policy
75 70
76 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 71 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_pref_store.cc ('k') | chrome/browser/policy/configuration_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698