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

Side by Side Diff: components/policy/core/browser/configuration_policy_handler.h

Issue 1019283005: Cleanup the ConfigurationPolicyHandler interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix if condition. Created 5 years, 8 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ 5 #ifndef COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_
6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ 6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual bool CheckPolicySettings(const PolicyMap& policies, 48 virtual bool CheckPolicySettings(const PolicyMap& policies,
49 PolicyErrorMap* errors) = 0; 49 PolicyErrorMap* errors) = 0;
50 50
51 // Processes the policies handled by this ConfigurationPolicyHandler and sets 51 // Processes the policies handled by this ConfigurationPolicyHandler and sets
52 // the appropriate preferences in |prefs|. 52 // the appropriate preferences in |prefs|.
53 virtual void ApplyPolicySettingsWithParameters( 53 virtual void ApplyPolicySettingsWithParameters(
54 const PolicyMap& policies, 54 const PolicyMap& policies,
55 const PolicyHandlerParameters& parameters, 55 const PolicyHandlerParameters& parameters,
56 PrefValueMap* prefs); 56 PrefValueMap* prefs);
57 57
58 // This is a convenience version of ApplyPolicySettingsWithParameters()
59 // that leaves out the |parameters|. Anyone extending
60 // ConfigurationPolicyHandler should implement either ApplyPolicySettings or
61 // ApplyPolicySettingsWithParameters.
62 virtual void ApplyPolicySettings(const PolicyMap& policies,
63 PrefValueMap* prefs);
64
65 // Modifies the values of some of the policies in |policies| so that they 58 // Modifies the values of some of the policies in |policies| so that they
66 // are more suitable to display to the user. This can be used to remove 59 // are more suitable to display to the user. This can be used to remove
67 // sensitive values such as passwords, or to pretty-print values. 60 // sensitive values such as passwords, or to pretty-print values.
68 virtual void PrepareForDisplaying(PolicyMap* policies) const; 61 virtual void PrepareForDisplaying(PolicyMap* policies) const;
69 62
63 protected:
64 // This is a convenience version of ApplyPolicySettingsWithParameters()
65 // for derived classes that leaves out the |parameters|. Anyone extending
66 // ConfigurationPolicyHandler should implement either
67 // ApplyPolicySettingsWithParameters directly and implement
68 // ApplyPolicySettings with a NOTREACHED or implement only
69 // ApplyPolicySettings.
70 virtual void ApplyPolicySettings(const PolicyMap& policies,
71 PrefValueMap* prefs) = 0;
72
70 private: 73 private:
71 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandler); 74 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandler);
72 }; 75 };
73 76
74 // Abstract class derived from ConfigurationPolicyHandler that should be 77 // Abstract class derived from ConfigurationPolicyHandler that should be
75 // subclassed to handle a single policy (not a combination of policies). 78 // subclassed to handle a single policy (not a combination of policies).
76 class POLICY_EXPORT TypeCheckingPolicyHandler 79 class POLICY_EXPORT TypeCheckingPolicyHandler
77 : public ConfigurationPolicyHandler { 80 : public ConfigurationPolicyHandler {
78 public: 81 public:
79 TypeCheckingPolicyHandler(const char* policy_name, 82 TypeCheckingPolicyHandler(const char* policy_name,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 : public ConfigurationPolicyHandler { 335 : public ConfigurationPolicyHandler {
333 public: 336 public:
334 LegacyPoliciesDeprecatingPolicyHandler( 337 LegacyPoliciesDeprecatingPolicyHandler(
335 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, 338 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers,
336 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler); 339 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler);
337 ~LegacyPoliciesDeprecatingPolicyHandler() override; 340 ~LegacyPoliciesDeprecatingPolicyHandler() override;
338 341
339 // ConfigurationPolicyHandler: 342 // ConfigurationPolicyHandler:
340 bool CheckPolicySettings(const PolicyMap& policies, 343 bool CheckPolicySettings(const PolicyMap& policies,
341 PolicyErrorMap* errors) override; 344 PolicyErrorMap* errors) override;
345 void ApplyPolicySettingsWithParameters(
346 const policy::PolicyMap& policies,
347 const policy::PolicyHandlerParameters& parameters,
348 PrefValueMap* prefs) override;
349
350 protected:
342 void ApplyPolicySettings(const PolicyMap& policies, 351 void ApplyPolicySettings(const PolicyMap& policies,
343 PrefValueMap* prefs) override; 352 PrefValueMap* prefs) override;
344 353
345 private: 354 private:
346 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; 355 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_;
347 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; 356 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_;
348 357
349 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); 358 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler);
350 }; 359 };
351 360
352 } // namespace policy 361 } // namespace policy
353 362
354 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ 363 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_dir_policy_handler.cc ('k') | components/policy/core/browser/configuration_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698