Update V8 to version 4.6.62.
[chromium-blink-merge.git] / components / policy / core / common / proxy_policy_provider.h
blob9066b562d6c43cdcdb7cd51cb6d2411ce7bab945
1 // Copyright 2014 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_PROXY_POLICY_PROVIDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "components/policy/core/common/configuration_policy_provider.h"
10 #include "components/policy/policy_export.h"
12 namespace policy {
14 // A policy provider implementation that acts as a proxy for another policy
15 // provider, swappable at any point.
17 // Note that ProxyPolicyProvider correctly forwards RefreshPolicies() calls to
18 // the delegate if present. If there is no delegate, the refresh results in an
19 // immediate (empty) policy update.
21 // Furthermore, IsInitializationComplete() is implemented trivially - it always
22 // returns true. Given that the delegate may be swapped at any point, there's no
23 // point in trying to carry over initialization status from the delegate.
25 // This policy provider implementation is used to inject browser-global policy
26 // originating from the user policy configured on the primary Chrome OS user
27 // (i.e. the user logging in from the login screen). This way, policy settings
28 // on the primary user propagate into g_browser_process->local_state_().
30 // The bizarre situation of user-scoped policy settings which are implemented
31 // browser-global wouldn't exist in an ideal world. However, for historic
32 // and technical reasons there are policy settings that are scoped to the user
33 // but are implemented to take effect for the entire browser instance. A good
34 // example for this are policies that affect the Chrome network stack in areas
35 // where there's no profile-specific context. The meta data in
36 // policy_templates.json allows to identify the policies in this bucket; they'll
37 // have per_profile set to False, supported_on including chrome_os, and
38 // dynamic_refresh set to True.
39 class POLICY_EXPORT ProxyPolicyProvider
40 : public ConfigurationPolicyProvider,
41 public ConfigurationPolicyProvider::Observer {
42 public:
43 ProxyPolicyProvider();
44 ~ProxyPolicyProvider() override;
46 // Updates the provider this proxy delegates to.
47 void SetDelegate(ConfigurationPolicyProvider* delegate);
49 // ConfigurationPolicyProvider:
50 void Shutdown() override;
51 void RefreshPolicies() override;
53 // ConfigurationPolicyProvider::Observer:
54 void OnUpdatePolicy(ConfigurationPolicyProvider* provider) override;
56 private:
57 ConfigurationPolicyProvider* delegate_;
59 DISALLOW_COPY_AND_ASSIGN(ProxyPolicyProvider);
62 } // namespace policy
64 #endif // COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_