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

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

Issue 8258018: Generate Chrome policy definition list from policy_templates.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the unittest fix Created 9 years, 2 months 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) 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_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 <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "policy/configuration_policy_type.h" 16 #include "policy/configuration_policy_type.h"
17 17
18 namespace policy { 18 namespace policy {
19 19
20 struct PolicyDefinitionList;
20 class PolicyMap; 21 class PolicyMap;
21 22
22 // A mostly-abstract super class for platform-specific policy providers. 23 // A mostly-abstract super class for platform-specific policy providers.
23 // Platform-specific policy providers (Windows Group Policy, gconf, 24 // Platform-specific policy providers (Windows Group Policy, gconf,
24 // etc.) should implement a subclass of this class. 25 // etc.) should implement a subclass of this class.
25 class ConfigurationPolicyProvider { 26 class ConfigurationPolicyProvider {
26 public: 27 public:
27 class Observer { 28 class Observer {
28 public: 29 public:
29 virtual ~Observer() {} 30 virtual ~Observer() {}
30 virtual void OnUpdatePolicy() = 0; 31 virtual void OnUpdatePolicy() = 0;
31 virtual void OnProviderGoingAway() = 0; 32 virtual void OnProviderGoingAway() = 0;
32 }; 33 };
33 34
34 // Used for static arrays of policy values that is used to initialize an
35 // instance of the ConfigurationPolicyProvider.
36 struct PolicyDefinitionList {
37 struct Entry {
38 ConfigurationPolicyType policy_type;
39 base::Value::Type value_type;
40 const char* name;
41 };
42
43 const Entry* begin;
44 const Entry* end;
45 };
46
47 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list); 35 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list);
48 36
49 virtual ~ConfigurationPolicyProvider(); 37 virtual ~ConfigurationPolicyProvider();
50 38
51 // Fills the given |result| with the current policy values. Returns true if 39 // Fills the given |result| with the current policy values. Returns true if
52 // the policies were provided. This is used mainly by the 40 // the policies were provided. This is used mainly by the
53 // ConfigurationPolicyPrefStore, which retrieves policy values from here. 41 // ConfigurationPolicyPrefStore, which retrieves policy values from here.
54 bool Provide(PolicyMap* result); 42 bool Provide(PolicyMap* result);
55 43
56 // Check whether this provider has completed initialization. This is used to 44 // Check whether this provider has completed initialization. This is used to
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 private: 106 private:
119 ConfigurationPolicyProvider* provider_; 107 ConfigurationPolicyProvider* provider_;
120 ConfigurationPolicyProvider::Observer* observer_; 108 ConfigurationPolicyProvider::Observer* observer_;
121 109
122 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar); 110 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar);
123 }; 111 };
124 112
125 } // namespace policy 113 } // namespace policy
126 114
127 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 115 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698