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

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

Issue 775613004: Improve documentation for special-purpose policy providers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy_provider_dcheck
Patch Set: Address nits. Created 6 years 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 2014 The Chromium Authors. All rights reserved. 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 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_PROXY_POLICY_PROVIDER_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "components/policy/core/common/configuration_policy_provider.h" 9 #include "components/policy/core/common/configuration_policy_provider.h"
10 #include "components/policy/policy_export.h" 10 #include "components/policy/policy_export.h"
11 11
12 namespace policy { 12 namespace policy {
13 13
14 // A policy provider implementation that acts as a proxy for another policy 14 // A policy provider implementation that acts as a proxy for another policy
15 // provider, swappable at any point. 15 // provider, swappable at any point.
16 //
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.
20 //
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.
24 //
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_().
29 //
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.
16 class POLICY_EXPORT ProxyPolicyProvider 39 class POLICY_EXPORT ProxyPolicyProvider
17 : public ConfigurationPolicyProvider, 40 : public ConfigurationPolicyProvider,
18 public ConfigurationPolicyProvider::Observer { 41 public ConfigurationPolicyProvider::Observer {
19 public: 42 public:
20 ProxyPolicyProvider(); 43 ProxyPolicyProvider();
21 virtual ~ProxyPolicyProvider(); 44 virtual ~ProxyPolicyProvider();
22 45
23 // Updates the provider this proxy delegates to. 46 // Updates the provider this proxy delegates to.
24 void SetDelegate(ConfigurationPolicyProvider* delegate); 47 void SetDelegate(ConfigurationPolicyProvider* delegate);
25 48
26 // ConfigurationPolicyProvider: 49 // ConfigurationPolicyProvider:
27 virtual void Shutdown() override; 50 virtual void Shutdown() override;
28 virtual void RefreshPolicies() override; 51 virtual void RefreshPolicies() override;
29 52
30 // ConfigurationPolicyProvider::Observer: 53 // ConfigurationPolicyProvider::Observer:
31 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) override; 54 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) override;
32 55
33 private: 56 private:
34 ConfigurationPolicyProvider* delegate_; 57 ConfigurationPolicyProvider* delegate_;
35 58
36 DISALLOW_COPY_AND_ASSIGN(ProxyPolicyProvider); 59 DISALLOW_COPY_AND_ASSIGN(ProxyPolicyProvider);
37 }; 60 };
38 61
39 } // namespace policy 62 } // namespace policy
40 63
41 #endif // COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_ 64 #endif // COMPONENTS_POLICY_CORE_COMMON_PROXY_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698