 Chromium Code Reviews
 Chromium Code Reviews Issue 197013007:
  Set drive as the default download folder  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 197013007:
  Set drive as the default download folder  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 | 
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" | 
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" | 
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" | 
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" | 
| 15 #include "base/values.h" | 15 #include "base/values.h" | 
| 16 #include "components/policy/core/common/schema.h" | 16 #include "components/policy/core/common/schema.h" | 
| 17 #include "components/policy/policy_export.h" | 17 #include "components/policy/policy_export.h" | 
| 18 | 18 | 
| 19 class PrefValueMap; | 19 class PrefValueMap; | 
| 20 | 20 | 
| 21 namespace policy { | 21 namespace policy { | 
| 22 | 22 | 
| 23 class PolicyErrorMap; | 23 class PolicyErrorMap; | 
| 24 class PolicyMap; | 24 class PolicyMap; | 
| 25 struct PolicyHandlerParameters; | |
| 25 | 26 | 
| 26 // Maps a policy type to a preference path, and to the expected value type. | 27 // Maps a policy type to a preference path, and to the expected value type. | 
| 27 struct POLICY_EXPORT PolicyToPreferenceMapEntry { | 28 struct POLICY_EXPORT PolicyToPreferenceMapEntry { | 
| 28 const char* const policy_name; | 29 const char* const policy_name; | 
| 29 const char* const preference_path; | 30 const char* const preference_path; | 
| 30 const base::Value::Type value_type; | 31 const base::Value::Type value_type; | 
| 31 }; | 32 }; | 
| 32 | 33 | 
| 33 // An abstract super class that subclasses should implement to map policies to | 34 // An abstract super class that subclasses should implement to map policies to | 
| 34 // their corresponding preferences, and to check whether the policies are valid. | 35 // their corresponding preferences, and to check whether the policies are valid. | 
| 35 class POLICY_EXPORT ConfigurationPolicyHandler { | 36 class POLICY_EXPORT ConfigurationPolicyHandler { | 
| 36 public: | 37 public: | 
| 37 static std::string ValueTypeToString(base::Value::Type type); | 38 static std::string ValueTypeToString(base::Value::Type type); | 
| 38 | 39 | 
| 39 ConfigurationPolicyHandler(); | 40 ConfigurationPolicyHandler(); | 
| 40 virtual ~ConfigurationPolicyHandler(); | 41 virtual ~ConfigurationPolicyHandler(); | 
| 41 | 42 | 
| 42 // Returns whether the policy settings handled by this | 43 // Returns whether the policy settings handled by this | 
| 43 // ConfigurationPolicyHandler can be applied. Fills |errors| with error | 44 // ConfigurationPolicyHandler can be applied. Fills |errors| with error | 
| 44 // messages or warnings. |errors| may contain error messages even when | 45 // messages or warnings. |errors| may contain error messages even when | 
| 45 // |CheckPolicySettings()| returns true. | 46 // |CheckPolicySettings()| returns true. | 
| 46 virtual bool CheckPolicySettings(const PolicyMap& policies, | 47 virtual bool CheckPolicySettings(const PolicyMap& policies, | 
| 47 PolicyErrorMap* errors) = 0; | 48 PolicyErrorMap* errors) = 0; | 
| 48 | 49 | 
| 49 // Processes the policies handled by this ConfigurationPolicyHandler and sets | 50 // Processes the policies handled by this ConfigurationPolicyHandler and sets | 
| 50 // the appropriate preferences in |prefs|. | 51 // the appropriate preferences in |prefs|. | 
| 51 virtual void ApplyPolicySettings(const PolicyMap& policies, | 52 virtual void ApplyPolicySettings(const PolicyMap& policies, | 
| 52 PrefValueMap* prefs) = 0; | 53 PrefValueMap* prefs) = 0; | 
| 53 | 54 | 
| 55 // Processes the policies handled by this ConfigurationPolicyHandler and sets | |
| 56 // the appropriate preferences in |prefs|. | |
| 57 // This function takes an additional input that could be used to supply | |
| 
bartfab (slow)
2014/03/13 13:20:00
Nit: "that could be used to supply" makes no sense
 | |
| 58 // parameters in |pars| to the policy handlers. | |
| 
bartfab (slow)
2014/03/13 13:20:00
Nit: s/handlers/handler/
 | |
| 59 virtual void ApplyPolicySettingsWithPars(const PolicyMap& policies, | |
| 
bartfab (slow)
2014/03/13 13:20:00
Nit: Avoid abbreviations: s/Pars/Parameters/
 | |
| 60 const PolicyHandlerParameters& pars, | |
| 
bartfab (slow)
2014/03/13 13:20:00
Nit: Avoid abbreviations: s/pars/parameters/
 | |
| 61 PrefValueMap* prefs); | |
| 62 | |
| 54 // Modifies the values of some of the policies in |policies| so that they | 63 // Modifies the values of some of the policies in |policies| so that they | 
| 55 // are more suitable to display to the user. This can be used to remove | 64 // are more suitable to display to the user. This can be used to remove | 
| 56 // sensitive values such as passwords, or to pretty-print values. | 65 // sensitive values such as passwords, or to pretty-print values. | 
| 57 virtual void PrepareForDisplaying(PolicyMap* policies) const; | 66 virtual void PrepareForDisplaying(PolicyMap* policies) const; | 
| 58 | 67 | 
| 59 private: | 68 private: | 
| 60 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandler); | 69 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandler); | 
| 61 }; | 70 }; | 
| 62 | 71 | 
| 63 // Abstract class derived from ConfigurationPolicyHandler that should be | 72 // Abstract class derived from ConfigurationPolicyHandler that should be | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 private: | 292 private: | 
| 284 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; | 293 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; | 
| 285 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; | 294 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; | 
| 286 | 295 | 
| 287 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); | 296 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); | 
| 288 }; | 297 }; | 
| 289 | 298 | 
| 290 } // namespace policy | 299 } // namespace policy | 
| 291 | 300 | 
| 292 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 301 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 
| OLD | NEW |