Chromium Code Reviews| 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; |
|
Devlin
2016/07/18 13:29:46
nit: initialize this value.
Lei Zhang
2016/07/19 01:46:17
Why? The value is used as an out parameter, and th
Devlin
2016/07/19 15:00:07
Style guide requires variable initialization with
Lei Zhang
2016/07/19 19:02:08
https://google.github.io/styleguide/cppguide.html#
Devlin
2016/07/19 19:12:38
Given I'm not an owner here (this was just a drive
|
| + 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; |
| } |