Index: chrome/browser/profiles/incognito_mode_policy_handler.cc |
diff --git a/chrome/browser/profiles/incognito_mode_policy_handler.cc b/chrome/browser/profiles/incognito_mode_policy_handler.cc |
index fc180cb82d3865735a2959e2f8d955417b5aa192..33c7701f92c8de824ad9e7fb075116ffe256ef3a 100644 |
--- a/chrome/browser/profiles/incognito_mode_policy_handler.cc |
+++ b/chrome/browser/profiles/incognito_mode_policy_handler.cc |
@@ -23,36 +23,33 @@ IncognitoModePolicyHandler::~IncognitoModePolicyHandler() {} |
bool IncognitoModePolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
PolicyErrorMap* errors) { |
- int int_value = IncognitoModePrefs::ENABLED; |
const base::Value* availability = |
policies.GetValue(key::kIncognitoModeAvailability); |
- |
if (availability) { |
- if (availability->GetAsInteger(&int_value)) { |
- IncognitoModePrefs::Availability availability_enum_value; |
- if (!IncognitoModePrefs::IntToAvailability(int_value, |
- &availability_enum_value)) { |
- errors->AddError(key::kIncognitoModeAvailability, |
- IDS_POLICY_OUT_OF_RANGE_ERROR, |
- base::IntToString(int_value)); |
- return false; |
- } |
- } else { |
- errors->AddError(key::kIncognitoModeAvailability, |
- IDS_POLICY_TYPE_ERROR, |
- ValueTypeToString(base::Value::TYPE_INTEGER)); |
+ int int_value = IncognitoModePrefs::ENABLED; |
+ if (!availability->GetAsInteger(&int_value)) { |
+ errors->AddError(key::kIncognitoModeAvailability, IDS_POLICY_TYPE_ERROR, |
+ base::Value::GetTypeName(base::Value::TYPE_INTEGER)); |
return false; |
} |
- } else { |
- const base::Value* deprecated_enabled = |
- policies.GetValue(key::kIncognitoEnabled); |
- if (deprecated_enabled && |
- !deprecated_enabled->IsType(base::Value::TYPE_BOOLEAN)) { |
- errors->AddError(key::kIncognitoEnabled, |
- IDS_POLICY_TYPE_ERROR, |
- ValueTypeToString(base::Value::TYPE_BOOLEAN)); |
+ IncognitoModePrefs::Availability availability_enum_value; |
+ if (!IncognitoModePrefs::IntToAvailability(int_value, |
+ &availability_enum_value)) { |
+ errors->AddError(key::kIncognitoModeAvailability, |
+ IDS_POLICY_OUT_OF_RANGE_ERROR, |
+ base::IntToString(int_value)); |
return false; |
} |
+ return true; |
+ } |
+ |
+ const base::Value* deprecated_enabled = |
+ policies.GetValue(key::kIncognitoEnabled); |
+ if (deprecated_enabled && |
+ !deprecated_enabled->IsType(base::Value::TYPE_BOOLEAN)) { |
+ errors->AddError(key::kIncognitoEnabled, IDS_POLICY_TYPE_ERROR, |
+ base::Value::GetTypeName(base::Value::TYPE_BOOLEAN)); |
+ return false; |
} |
return true; |
} |