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

Side by Side Diff: components/policy/core/common/configuration_policy_provider.h

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual void RefreshPolicies() = 0; 67 virtual void RefreshPolicies() = 0;
68 68
69 // Observers must detach themselves before the provider is deleted. 69 // Observers must detach themselves before the provider is deleted.
70 virtual void AddObserver(Observer* observer); 70 virtual void AddObserver(Observer* observer);
71 virtual void RemoveObserver(Observer* observer); 71 virtual void RemoveObserver(Observer* observer);
72 72
73 // SchemaRegistry::Observer: 73 // SchemaRegistry::Observer:
74 void OnSchemaRegistryUpdated(bool has_new_schemas) override; 74 void OnSchemaRegistryUpdated(bool has_new_schemas) override;
75 void OnSchemaRegistryReady() override; 75 void OnSchemaRegistryReady() override;
76 76
77 PolicySource source() const { return source_; }
bartfab (slow) 2015/09/14 14:42:27 Nit: #include "components/policy/core/common/polic
fhorschig 2015/09/16 13:52:05 Done.
78
77 protected: 79 protected:
78 // Subclasses must invoke this to update the policies currently served by 80 // Subclasses must invoke this to update the policies currently served by
79 // this provider. UpdatePolicy() takes ownership of |policies|. 81 // this provider. UpdatePolicy() takes ownership of |policies|.
80 // The observers are notified after the policies are updated. 82 // The observers are notified after the policies are updated.
81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); 83 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle);
82 84
83 SchemaRegistry* schema_registry() const; 85 SchemaRegistry* schema_registry() const;
84 86
85 const scoped_refptr<SchemaMap>& schema_map() const; 87 const scoped_refptr<SchemaMap>& schema_map() const;
86 88
89 // This provider provides policies only from one source at a time (defaulting
90 // to POLICY_SOURCE_UNKNOWN).
91 PolicySource source_;
92
87 private: 93 private:
94 // Used to tag all policies provided as coming from |source_|.
95 void SetPolicySources();
96
88 // The policies currently configured at this provider. 97 // The policies currently configured at this provider.
89 PolicyBundle policy_bundle_; 98 PolicyBundle policy_bundle_;
90 99
91 // Used to validate proper Init() and Shutdown() nesting. This flag is set by 100 // Used to validate proper Init() and Shutdown() nesting. This flag is set by
92 // Init() and cleared by Shutdown() and needs to be false in the destructor. 101 // Init() and cleared by Shutdown() and needs to be false in the destructor.
93 bool initialized_; 102 bool initialized_;
94 103
95 SchemaRegistry* schema_registry_; 104 SchemaRegistry* schema_registry_;
96 105
97 base::ObserverList<Observer, true> observer_list_; 106 base::ObserverList<Observer, true> observer_list_;
98 107
99 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); 108 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider);
100 }; 109 };
101 110
102 } // namespace policy 111 } // namespace policy
103 112
104 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ 113 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698