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

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

Issue 10384145: Removed ConfigurationPolicyProvider::Provide(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "chrome/browser/policy/policy_bundle.h" 12 #include "chrome/browser/policy/policy_bundle.h"
13 13
14 namespace policy { 14 namespace policy {
15 15
16 struct PolicyDefinitionList; 16 struct PolicyDefinitionList;
17 class PolicyMap;
18 17
19 // A mostly-abstract super class for platform-specific policy providers. 18 // A mostly-abstract super class for platform-specific policy providers.
20 // Platform-specific policy providers (Windows Group Policy, gconf, 19 // Platform-specific policy providers (Windows Group Policy, gconf,
21 // etc.) should implement a subclass of this class. 20 // etc.) should implement a subclass of this class.
22 class ConfigurationPolicyProvider { 21 class ConfigurationPolicyProvider {
23 public: 22 public:
24 class Observer { 23 class Observer {
25 public: 24 public:
26 virtual ~Observer(); 25 virtual ~Observer();
27 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0; 26 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0;
28 virtual void OnProviderGoingAway(ConfigurationPolicyProvider* provider); 27 virtual void OnProviderGoingAway(ConfigurationPolicyProvider* provider);
29 }; 28 };
30 29
31 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list); 30 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list);
32 31
33 virtual ~ConfigurationPolicyProvider(); 32 virtual ~ConfigurationPolicyProvider();
34 33
35 // Fills the given |result| with the current policy values. Returns true if
36 // the policies were provided. This is used mainly by the
37 // ConfigurationPolicyPrefStore, which retrieves policy values from here.
38 // DEPRECATED: this call is going away, use policies() instead.
39 // http://crbug.com/108993
40 bool Provide(PolicyMap* result);
41
42 // Returns the current PolicyBundle. 34 // Returns the current PolicyBundle.
43 const PolicyBundle& policies() const { return policy_bundle_; } 35 const PolicyBundle& policies() const { return policy_bundle_; }
44 36
45 // Check whether this provider has completed initialization. This is used to 37 // Check whether this provider has completed initialization. This is used to
46 // detect whether initialization is done in case providers implementations 38 // detect whether initialization is done in case providers implementations
47 // need to do asynchronous operations for initialization. 39 // need to do asynchronous operations for initialization.
48 virtual bool IsInitializationComplete() const; 40 virtual bool IsInitializationComplete() const;
49 41
50 // Asks the provider to refresh its policies. All the updates caused by this 42 // Asks the provider to refresh its policies. All the updates caused by this
51 // call will be visible on the next call of OnUpdatePolicy on the observers, 43 // call will be visible on the next call of OnUpdatePolicy on the observers,
52 // which are guaranteed to happen even if the refresh fails. 44 // which are guaranteed to happen even if the refresh fails.
53 // It is possible that OnProviderGoingAway is called first though, and 45 // It is possible that OnProviderGoingAway is called first though, and
54 // OnUpdatePolicy won't be called if that happens. 46 // OnUpdatePolicy won't be called if that happens.
55 virtual void RefreshPolicies() = 0; 47 virtual void RefreshPolicies() = 0;
56 48
57 // Utility method that converts deprecated policies into their corresponding
58 // actual policies. Subclasses can use this to fix deprecated policies in
59 // PolicyMaps that they obtained from elsewhere.
60 static void FixDeprecatedPolicies(PolicyMap* policies);
61
62 protected: 49 protected:
63 // Subclasses must invoke this to update the policies currently served by 50 // Subclasses must invoke this to update the policies currently served by
64 // this provider. UpdatePolicy() takes ownership of |policies|. 51 // this provider. UpdatePolicy() takes ownership of |policies|.
65 // The observers are notified after the policies are updated. 52 // The observers are notified after the policies are updated.
66 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); 53 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle);
67 54
68 const PolicyDefinitionList* policy_definition_list() const { 55 const PolicyDefinitionList* policy_definition_list() const {
69 return policy_definition_list_; 56 return policy_definition_list_;
70 } 57 }
71 58
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 private: 96 private:
110 ConfigurationPolicyProvider* provider_; 97 ConfigurationPolicyProvider* provider_;
111 ConfigurationPolicyProvider::Observer* observer_; 98 ConfigurationPolicyProvider::Observer* observer_;
112 99
113 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar); 100 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar);
114 }; 101 };
115 102
116 } // namespace policy 103 } // namespace policy
117 104
118 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 105 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/config_dir_policy_provider_unittest.cc ('k') | chrome/browser/policy/configuration_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698