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

Unified Diff: chrome/browser/profiles/incognito_mode_policy_handler.cc

Issue 2149253003: Switch various ValueTypeToString()s to base::Value::GetTypeName(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@value
Patch Set: fix tests Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698