Commit 9d10a54d authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Remove uses of deprecated override of PrefValueMap::SetValue

Convert client of the deprecated of PrefValueMap::SetValue taking
a std::unique_ptr<base::Value> to the recommended override taking
a base::Value directly.

The conversion is done using the following rules:

- If the value is built inline using std::make_unique<base::Value>
  then change to just construct a base::Value directly,

- If the value is built use base::Value::CreateDeepCopy(), then
  change to use base::Clone() which returns a base::Value instead
  of a std::unique_ptr<base::Value>,

- If the std::unique_ptr<base::Value> is just forwarded by the
  caller, dcheck it is not null (the check was present in the old
  method implementation) and use base::Value::FromUniquePtrValue
  to convert the std::unique_ptr<base::Value> to a base::Value.

This CL fixes uses in src/chrome/browser/spellchecker.

This CL was uploaded by git cl split.

Bug: 646113
Change-Id: I0cc2c207c8e1fdf11710c29aa0ca78fb982758a8
Reviewed-on: https://chromium-review.googlesource.com/c/1446356Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627979}
parent 1f46de0d
......@@ -41,21 +41,19 @@ void SpellcheckLanguagePolicyHandler::ApplyPolicySettings(
const base::Value::ListStorage& languages = value->GetList();
std::unique_ptr<base::ListValue> forced_language_list =
std::make_unique<base::ListValue>();
std::vector<base::Value> forced_language_list;
for (const base::Value& language : languages) {
std::string current_language =
spellcheck::GetCorrespondingSpellCheckLanguage(
base::TrimWhitespaceASCII(language.GetString(), base::TRIM_ALL));
if (!current_language.empty()) {
forced_language_list->GetList().push_back(base::Value(current_language));
forced_language_list.emplace_back(std::move(current_language));
} else {
LOG(WARNING) << "Unknown language requested: \"" << language << "\"";
}
}
prefs->SetValue(spellcheck::prefs::kSpellCheckEnable,
std::make_unique<base::Value>(true));
prefs->SetValue(spellcheck::prefs::kSpellCheckEnable, base::Value(true));
prefs->SetValue(spellcheck::prefs::kSpellCheckForcedDictionaries,
std::move(forced_language_list));
base::Value(std::move(forced_language_list)));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment