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

Unified Diff: chrome/browser/policy/configuration_policy_handler.cc

Issue 8480003: Surface error messages from ONC parsing in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased version with password stripping. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/configuration_policy_handler.cc
diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc
index 18e5696923bfc8ad753f6fb682fff5538eb879de..ee470ea85bed68ea5b9905c7ef4e9ff341fe000b 100644
--- a/chrome/browser/policy/configuration_policy_handler.cc
+++ b/chrome/browser/policy/configuration_policy_handler.cc
@@ -166,8 +166,15 @@ ConfigurationPolicyType TypeCheckingPolicyHandler::policy_type() const {
bool TypeCheckingPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
PolicyErrorMap* errors) {
- const Value* value = policies.Get(policy_type_);
- if (value && value_type_ != value->GetType()) {
+ const Value* value = NULL;
+ return CheckAndGetValue(policies, errors, &value);
+}
+
+bool TypeCheckingPolicyHandler::CheckAndGetValue(const PolicyMap& policies,
+ PolicyErrorMap* errors,
+ const Value** value) {
+ *value = policies.Get(policy_type_);
+ if (*value && !(*value)->IsType(value_type_)) {
errors->AddError(policy_type_,
IDS_POLICY_TYPE_ERROR,
ValueTypeToString(value_type_));
@@ -176,7 +183,6 @@ bool TypeCheckingPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
return true;
}
-
// SimplePolicyHandler implementation ------------------------------------------
SimplePolicyHandler::SimplePolicyHandler(

Powered by Google App Engine
This is Rietveld 408576698