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

Unified Diff: chrome/browser/extensions/api/system_private/system_private_api.cc

Issue 1991083002: Remove ExtensionFunction::SetResult(T*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 7 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/extensions/api/system_private/system_private_api.cc
diff --git a/chrome/browser/extensions/api/system_private/system_private_api.cc b/chrome/browser/extensions/api/system_private/system_private_api.cc
index 6f3f94c1a26aff8c7c1a427e05ce319f08ecf5e3..ff98c4b1753bc3d3a9bb1ed71dcb42b7a62d11e1 100644
--- a/chrome/browser/extensions/api/system_private/system_private_api.cc
+++ b/chrome/browser/extensions/api/system_private/system_private_api.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -75,7 +76,8 @@ bool SystemPrivateGetIncognitoModeAvailabilityFunction::RunSync() {
EXTENSION_FUNCTION_VALIDATE(
value >= 0 &&
value < static_cast<int>(arraysize(kIncognitoModeAvailabilityStrings)));
- SetResult(new base::StringValue(kIncognitoModeAvailabilityStrings[value]));
+ SetResult(base::MakeUnique<base::StringValue>(
+ kIncognitoModeAvailabilityStrings[value]));
return true;
}
@@ -133,16 +135,16 @@ bool SystemPrivateGetUpdateStatusFunction::RunSync() {
state = kNotAvailableState;
}
#endif
- base::DictionaryValue* dict = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString(kStateKey, state);
dict->SetDouble(kDownloadProgressKey, download_progress);
- SetResult(dict);
+ SetResult(std::move(dict));
return true;
}
bool SystemPrivateGetApiKeyFunction::RunSync() {
- SetResult(new base::StringValue(google_apis::GetAPIKey()));
+ SetResult(base::MakeUnique<base::StringValue>(google_apis::GetAPIKey()));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698