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

Unified Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 2820823005: Revert of Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: Created 3 years, 8 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/ui/webui/options/core_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc
index ec45725bbe2fe3946627a53cff091848dc74272f..c7098cabd8c335b5010e0c99474886e748193a41 100644
--- a/chrome/browser/ui/webui/options/core_options_handler.cc
+++ b/chrome/browser/ui/webui/options/core_options_handler.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/json/json_reader.h"
-#include "base/memory/ptr_util.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
@@ -253,8 +252,7 @@
handlers_host_->OnFinishedLoading();
}
-std::unique_ptr<base::Value> CoreOptionsHandler::FetchPref(
- const std::string& pref_name) {
+base::Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) {
return CreateValueForPref(pref_name, std::string());
}
@@ -366,7 +364,7 @@
}
}
-std::unique_ptr<base::Value> CoreOptionsHandler::CreateValueForPref(
+base::Value* CoreOptionsHandler::CreateValueForPref(
const std::string& pref_name,
const std::string& controlling_pref_name) {
const PrefService* pref_service = FindServiceForPref(pref_name);
@@ -374,15 +372,15 @@
pref_service->FindPreference(pref_name);
if (!pref) {
NOTREACHED();
- return base::MakeUnique<base::Value>();
+ return new base::Value();
}
const PrefService::Preference* controlling_pref =
pref_service->FindPreference(controlling_pref_name);
if (!controlling_pref)
controlling_pref = pref;
- auto dict = base::MakeUnique<base::DictionaryValue>();
- dict->Set("value", base::MakeUnique<base::Value>(*pref->GetValue()));
+ base::DictionaryValue* dict = new base::DictionaryValue;
+ dict->Set("value", pref->GetValue()->DeepCopy());
if (controlling_pref->IsManaged()) {
dict->SetString("controlledBy", "policy");
} else if (controlling_pref->IsExtensionControlled() &&
@@ -399,7 +397,8 @@
extension_id, extensions::ExtensionRegistry::EVERYTHING);
if (extension) {
dict->SetString("controlledBy", "extension");
- dict->Set("extension", extensions::util::GetExtensionInfo(extension));
+ dict->Set("extension",
+ extensions::util::GetExtensionInfo(extension).release());
}
} else if (controlling_pref->IsRecommended()) {
dict->SetString("controlledBy", "recommended");
@@ -408,10 +407,9 @@
const base::Value* recommended_value =
controlling_pref->GetRecommendedValue();
if (recommended_value)
- dict->Set("recommendedValue",
- base::MakeUnique<base::Value>(*recommended_value));
+ dict->Set("recommendedValue", recommended_value->DeepCopy());
dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable());
- return std::move(dict);
+ return dict;
}
PrefService* CoreOptionsHandler::FindServiceForPref(
« no previous file with comments | « chrome/browser/ui/webui/options/core_options_handler.h ('k') | chrome/browser/ui/webui/options/handler_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698