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

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

Issue 10236003: Added RefreshPolicies to PolicyService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/policy_service.h ('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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 23 matching lines...) Expand all
34 virtual void AddObserver(PolicyDomain domain, 34 virtual void AddObserver(PolicyDomain domain,
35 const std::string& component_id, 35 const std::string& component_id,
36 PolicyService::Observer* observer) OVERRIDE; 36 PolicyService::Observer* observer) OVERRIDE;
37 virtual void RemoveObserver(PolicyDomain domain, 37 virtual void RemoveObserver(PolicyDomain domain,
38 const std::string& component_id, 38 const std::string& component_id,
39 PolicyService::Observer* observer) OVERRIDE; 39 PolicyService::Observer* observer) OVERRIDE;
40 virtual const PolicyMap* GetPolicies( 40 virtual const PolicyMap* GetPolicies(
41 PolicyDomain domain, 41 PolicyDomain domain,
42 const std::string& component_id) const OVERRIDE; 42 const std::string& component_id) const OVERRIDE;
43 virtual bool IsInitializationComplete() const OVERRIDE; 43 virtual bool IsInitializationComplete() const OVERRIDE;
44 virtual void RefreshPolicies(const base::Closure& callback) OVERRIDE;
44 45
45 private: 46 private:
46 struct Entry; 47 struct Entry;
47 struct ProviderData; 48 struct ProviderData;
48 49
49 typedef std::pair<PolicyDomain, std::string> PolicyNamespace; 50 typedef std::pair<PolicyDomain, std::string> PolicyNamespace;
50 typedef std::map<PolicyNamespace, Entry*> EntryMap; 51 typedef std::map<PolicyNamespace, Entry*> EntryMap;
51 typedef std::vector<ProviderData*> ProviderList; 52 typedef std::vector<ProviderData*> ProviderList;
52 53
53 // ConfigurationPolicyProvider::Observer overrides: 54 // ConfigurationPolicyProvider::Observer overrides:
54 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) OVERRIDE; 55 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) OVERRIDE;
55 virtual void OnProviderGoingAway( 56 virtual void OnProviderGoingAway(
56 ConfigurationPolicyProvider* provider) OVERRIDE; 57 ConfigurationPolicyProvider* provider) OVERRIDE;
57 58
58 Entry* GetOrCreate(const PolicyNamespace& ns); 59 Entry* GetOrCreate(const PolicyNamespace& ns);
59 ProviderList::iterator GetProviderData(ConfigurationPolicyProvider* provider); 60 ProviderList::iterator GetProviderData(ConfigurationPolicyProvider* provider);
60 61
61 // Erases the entry for |ns|, if it has no observers and no policies. 62 // Erases the entry for |ns|, if it has no observers and no policies.
62 void MaybeCleanup(const PolicyNamespace& ns); 63 void MaybeCleanup(const PolicyNamespace& ns);
63 64
64 // Combines the policies from all the providers, and notifies the observers 65 // Combines the policies from all the providers, and notifies the observers
65 // of namespaces whose policies have been modified. 66 // of namespaces whose policies have been modified.
66 void MergeAndTriggerUpdates(); 67 // |is_refresh| should be true if MergeAndTriggerUpdates() was invoked because
68 // a provider has just refreshed its policies.
69 void MergeAndTriggerUpdates(bool is_refresh);
67 70
68 // Contains all the providers together with a cached copy of their policies 71 // Contains all the providers together with a cached copy of their policies
69 // and their registrars. 72 // and their registrars.
70 ProviderList providers_; 73 ProviderList providers_;
71 74
72 // Maps each policy namespace to its current policies. 75 // Maps each policy namespace to its current policies.
73 EntryMap entries_; 76 EntryMap entries_;
74 77
75 // True if all the providers are initialized. 78 // True if all the providers are initialized.
76 bool initialization_complete_; 79 bool initialization_complete_;
77 80
81 // List of callbacks to invoke once all providers refresh after a
82 // RefreshPolicies() call.
83 std::vector<base::Closure> refresh_callbacks_;
84
78 DISALLOW_COPY_AND_ASSIGN(PolicyServiceImpl); 85 DISALLOW_COPY_AND_ASSIGN(PolicyServiceImpl);
79 }; 86 };
80 87
81 } // namespace policy 88 } // namespace policy
82 89
83 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_ 90 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_service.h ('k') | chrome/browser/policy/policy_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698