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

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

Issue 16254003: WIP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « chrome/browser/policy/policy_service.cc ('k') | chrome/browser/policy/policy_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_POLICY_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "chrome/browser/policy/configuration_policy_provider.h" 16 #include "chrome/browser/policy/configuration_policy_provider.h"
17 #include "chrome/browser/policy/policy_bundle.h"
18 #include "chrome/browser/policy/policy_service.h" 17 #include "chrome/browser/policy/policy_service.h"
19 18
20 namespace policy { 19 namespace policy {
21 20
22 class PolicyMap; 21 class PolicyMap;
23 22
24 class PolicyServiceImpl : public PolicyService, 23 class PolicyServiceImpl : public PolicyService,
25 public ConfigurationPolicyProvider::Observer { 24 public ConfigurationPolicyProvider::Observer {
26 public: 25 public:
27 typedef std::vector<ConfigurationPolicyProvider*> Providers; 26 typedef std::vector<ConfigurationPolicyProvider*> Providers;
28 27
29 // The PolicyServiceImpl will merge policies from |providers|. |providers| 28 // The PolicyServiceImpl will merge policies from |providers|. |providers|
30 // must be sorted in decreasing order of priority; the first provider will 29 // must be sorted in decreasing order of priority; the first provider will
31 // have the highest priority. The PolicyServiceImpl does not take ownership of 30 // have the highest priority. The PolicyServiceImpl does not take ownership of
32 // the providers, and they must outlive the PolicyServiceImpl. 31 // the providers, and they must outlive the PolicyServiceImpl.
33 explicit PolicyServiceImpl(const Providers& providers); 32 explicit PolicyServiceImpl(const Providers& providers);
34 virtual ~PolicyServiceImpl(); 33 virtual ~PolicyServiceImpl();
35 34
36 // PolicyService overrides: 35 // PolicyService overrides:
37 virtual void AddObserver(PolicyDomain domain, 36 virtual void AddObserver(PolicyDomain domain,
38 PolicyService::Observer* observer) OVERRIDE; 37 PolicyService::Observer* observer) OVERRIDE;
39 virtual void RemoveObserver(PolicyDomain domain, 38 virtual void RemoveObserver(PolicyDomain domain,
40 PolicyService::Observer* observer) OVERRIDE; 39 PolicyService::Observer* observer) OVERRIDE;
41 virtual void RegisterPolicyDomain( 40 virtual void RegisterPolicyDomain(
42 PolicyDomain domain, 41 PolicyDomain domain,
43 const std::set<std::string>& components) OVERRIDE; 42 const std::set<std::string>& components) OVERRIDE;
44 virtual const PolicyMap& GetPolicies( 43 virtual const PolicyMap& GetPolicies(
45 const PolicyNamespace& ns) const OVERRIDE; 44 const PolicyNamespace& ns) const OVERRIDE;
45 virtual const PolicyBundle& GetAllPolicies() const OVERRIDE;
46
46 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE; 47 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE;
47 virtual void RefreshPolicies(const base::Closure& callback) OVERRIDE; 48 virtual void RefreshPolicies(const base::Closure& callback) OVERRIDE;
48 49
49 private: 50 private:
50 typedef ObserverList<PolicyService::Observer, true> Observers; 51 typedef ObserverList<PolicyService::Observer, true> Observers;
51 typedef std::map<PolicyDomain, Observers*> ObserverMap; 52 typedef std::map<PolicyDomain, Observers*> ObserverMap;
52 53
53 // Information about policy changes sent to observers. 54 // Information about policy changes sent to observers.
54 class PolicyChangeInfo { 55 class PolicyChangeInfo {
55 public: 56 public:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Used to create tasks to delay new policy updates while we may be already 112 // Used to create tasks to delay new policy updates while we may be already
112 // processing previous policy updates. 113 // processing previous policy updates.
113 base::WeakPtrFactory<PolicyServiceImpl> weak_ptr_factory_; 114 base::WeakPtrFactory<PolicyServiceImpl> weak_ptr_factory_;
114 115
115 DISALLOW_COPY_AND_ASSIGN(PolicyServiceImpl); 116 DISALLOW_COPY_AND_ASSIGN(PolicyServiceImpl);
116 }; 117 };
117 118
118 } // namespace policy 119 } // namespace policy
119 120
120 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_ 121 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_service.cc ('k') | chrome/browser/policy/policy_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698