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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 16 matching lines...) Expand all
27 virtual ~Observer(); 27 virtual ~Observer();
28 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0; 28 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0;
29 }; 29 };
30 30
31 ConfigurationPolicyProvider(); 31 ConfigurationPolicyProvider();
32 32
33 // Policy providers can be deleted quite late during shutdown of the browser, 33 // Policy providers can be deleted quite late during shutdown of the browser,
34 // and it's not guaranteed that the message loops will still be running when 34 // and it's not guaranteed that the message loops will still be running when
35 // this is invoked. Override Shutdown() instead for cleanup code that needs 35 // this is invoked. Override Shutdown() instead for cleanup code that needs
36 // to post to the FILE thread, for example. 36 // to post to the FILE thread, for example.
37 virtual ~ConfigurationPolicyProvider(); 37 ~ConfigurationPolicyProvider() override;
38 38
39 // Invoked as soon as the main message loops are spinning. Policy providers 39 // Invoked as soon as the main message loops are spinning. Policy providers
40 // are created early during startup to provide the initial policies; the 40 // are created early during startup to provide the initial policies; the
41 // Init() call allows them to perform initialization tasks that require 41 // Init() call allows them to perform initialization tasks that require
42 // running message loops. 42 // running message loops.
43 // The policy provider will load policy for the components registered in 43 // The policy provider will load policy for the components registered in
44 // the |schema_registry| whose domain is supported by this provider. 44 // the |schema_registry| whose domain is supported by this provider.
45 virtual void Init(SchemaRegistry* registry); 45 virtual void Init(SchemaRegistry* registry);
46 46
47 // Must be invoked before deleting the provider. Implementations can override 47 // Must be invoked before deleting the provider. Implementations can override
(...skipping 16 matching lines...) Expand all
64 // which are guaranteed to happen even if the refresh fails. 64 // which are guaranteed to happen even if the refresh fails.
65 // It is possible that Shutdown() is called first though, and 65 // It is possible that Shutdown() is called first though, and
66 // OnUpdatePolicy won't be called if that happens. 66 // OnUpdatePolicy won't be called if that happens.
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 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) override; 74 void OnSchemaRegistryUpdated(bool has_new_schemas) override;
75 virtual void OnSchemaRegistryReady() override; 75 void OnSchemaRegistryReady() override;
76 76
77 protected: 77 protected:
78 // Subclasses must invoke this to update the policies currently served by 78 // Subclasses must invoke this to update the policies currently served by
79 // this provider. UpdatePolicy() takes ownership of |policies|. 79 // this provider. UpdatePolicy() takes ownership of |policies|.
80 // The observers are notified after the policies are updated. 80 // The observers are notified after the policies are updated.
81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); 81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle);
82 82
83 SchemaRegistry* schema_registry() const; 83 SchemaRegistry* schema_registry() const;
84 84
85 const scoped_refptr<SchemaMap>& schema_map() const; 85 const scoped_refptr<SchemaMap>& schema_map() const;
86 86
87 private: 87 private:
88 // The policies currently configured at this provider. 88 // The policies currently configured at this provider.
89 PolicyBundle policy_bundle_; 89 PolicyBundle policy_bundle_;
90 90
91 // Whether Shutdown() has been invoked. 91 // Whether Shutdown() has been invoked.
92 bool did_shutdown_; 92 bool did_shutdown_;
93 93
94 SchemaRegistry* schema_registry_; 94 SchemaRegistry* schema_registry_;
95 95
96 ObserverList<Observer, true> observer_list_; 96 ObserverList<Observer, true> observer_list_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); 98 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider);
99 }; 99 };
100 100
101 } // namespace policy 101 } // namespace policy
102 102
103 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ 103 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698