Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / components / policy / core / common / forwarding_policy_provider.h
blobdb24ff6cfae1b9eda6797ffc5c98a480f28d0546
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_FORWARDING_POLICY_PROVIDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_FORWARDING_POLICY_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "components/policy/core/common/configuration_policy_provider.h"
11 #include "components/policy/core/common/policy_namespace.h"
12 #include "components/policy/policy_export.h"
14 namespace policy {
16 // A policy provider that forwards calls to another provider.
17 // This provider also tracks the SchemaRegistry, and becomes ready after making
18 // sure the delegate provider has refreshed its policies with an updated view
19 // of the complete schema. It is expected that the delegate's SchemaRegistry
20 // is a CombinedSchemaRegistry tracking the forwarding provider's registry.
21 class POLICY_EXPORT ForwardingPolicyProvider
22 : public ConfigurationPolicyProvider,
23 public ConfigurationPolicyProvider::Observer {
24 public:
25 // The |delegate| must outlive this provider.
26 explicit ForwardingPolicyProvider(ConfigurationPolicyProvider* delegate);
27 virtual ~ForwardingPolicyProvider();
29 // ConfigurationPolicyProvider:
31 // Note that Init() and Shutdown() are not forwarded to the |delegate_|, since
32 // this provider does not own it and its up to the |delegate_|'s owner to
33 // initialize it and shut it down.
35 // Note also that this provider may have a SchemaRegistry passed in Init()
36 // that doesn't match the |delegate_|'s; therefore OnSchemaRegistryUpdated()
37 // and OnSchemaRegistryReady() are not forwarded either. It is assumed that
38 // the |delegate_|'s SchemaRegistry contains a superset of this provider's
39 // SchemaRegistry though (i.e. it's a CombinedSchemaRegistry that contains
40 // this provider's SchemaRegistry).
42 // This provider manages its own initialization state for all policy domains
43 // except POLICY_DOMAIN_CHROME, whose status is always queried from the
44 // |delegate_|. RefreshPolicies() calls are also forwarded, since this
45 // provider doesn't have a "real" policy source of its own.
46 virtual void Init(SchemaRegistry* registry) OVERRIDE;
47 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE;
48 virtual void RefreshPolicies() OVERRIDE;
49 virtual void OnSchemaRegistryReady() OVERRIDE;
50 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) OVERRIDE;
52 // ConfigurationPolicyProvider::Observer:
53 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) OVERRIDE;
55 private:
56 enum InitializationState {
57 WAITING_FOR_REGISTRY_READY,
58 WAITING_FOR_REFRESH,
59 READY,
62 ConfigurationPolicyProvider* delegate_;
63 InitializationState state_;
65 DISALLOW_COPY_AND_ASSIGN(ForwardingPolicyProvider);
68 } // namespace policy
70 #endif // COMPONENTS_POLICY_CORE_COMMON_FORWARDING_POLICY_PROVIDER_H_