OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_POLICY_FORWARDING_POLICY_PROVIDER_H_ | |
6 #define CHROME_BROWSER_POLICY_FORWARDING_POLICY_PROVIDER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "chrome/browser/policy/configuration_policy_provider.h" | |
11 #include "components/policy/core/common/policy_namespace.h" | |
12 | |
13 namespace policy { | |
14 | |
15 // A policy provider that forwards calls to another provider. | |
16 // This provider also tracks the SchemaRegistry, and becomes ready after making | |
17 // sure the delegate provider has refreshed its policies with an updated view | |
18 // of the complete schema. It is expected that the delegate's SchemaRegistry | |
19 // is a CombinedSchemaRegistry tracking the forwarding provider's registry. | |
20 class ForwardingPolicyProvider : public ConfigurationPolicyProvider, | |
21 public ConfigurationPolicyProvider::Observer { | |
22 public: | |
23 // The |delegate| must outlive this provider. | |
24 explicit ForwardingPolicyProvider(ConfigurationPolicyProvider* delegate); | |
25 virtual ~ForwardingPolicyProvider(); | |
26 | |
27 // ConfigurationPolicyProvider: | |
28 // Note that Init(), Shutdown(), OnSchemaRegistryUpdated() and | |
bartfab (slow)
2013/11/11 14:40:08
I think it would be clearer to list the calls that
Joao da Silva
2013/11/12 15:26:33
Done.
| |
29 // OnSchemaRegistryReady() are not forwarded to the |delegate_|. | |
30 virtual void Init(SchemaRegistry* registry) OVERRIDE; | |
31 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE; | |
32 virtual void RefreshPolicies() OVERRIDE; | |
33 virtual void OnSchemaRegistryReady() OVERRIDE; | |
34 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) OVERRIDE; | |
35 | |
36 // ConfigurationPolicyProvider::Observer: | |
37 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) OVERRIDE; | |
38 | |
39 private: | |
40 enum InitializationState { | |
41 WAITING_FOR_REGISTRY_READY, | |
42 WAITING_FOR_REFRESH, | |
43 READY, | |
44 }; | |
45 | |
46 ConfigurationPolicyProvider* delegate_; | |
47 InitializationState state_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(ForwardingPolicyProvider); | |
50 }; | |
51 | |
52 } // namespace policy | |
53 | |
54 #endif // CHROME_BROWSER_POLICY_FORWARDING_POLICY_PROVIDER_H_ | |
OLD | NEW |