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

Unified Diff: chrome/browser/extensions/api/notifications/notifications_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/notifications/notifications_api.cc
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index 5e172bcc3737c654aeb882ee0b4755b273f0a82b..d26317e05e32900c39bfd2a4140efce24472d743 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/guid.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
@@ -606,7 +607,7 @@ bool NotificationsCreateFunction::RunNotificationsApi() {
notification_id = base::RandBytesAsString(16);
}
- SetResult(new base::StringValue(notification_id));
+ SetResult(base::MakeUnique<base::StringValue>(notification_id));
// TODO(dewittj): Add more human-readable error strings if this fails.
if (!CreateNotification(notification_id, &params_->options))
@@ -634,7 +635,7 @@ bool NotificationsUpdateFunction::RunNotificationsApi() {
CreateScopedIdentifier(extension_->id(), params_->notification_id),
NotificationUIManager::GetProfileID(GetProfile()));
if (!matched_notification) {
- SetResult(new base::FundamentalValue(false));
+ SetResult(base::MakeUnique<base::FundamentalValue>(false));
SendResponse(true);
return true;
}
@@ -648,7 +649,8 @@ bool NotificationsUpdateFunction::RunNotificationsApi() {
// TODO(dewittj): Add more human-readable error strings if this fails.
bool could_update_notification = UpdateNotification(
params_->notification_id, &params_->options, &notification);
- SetResult(new base::FundamentalValue(could_update_notification));
+ SetResult(
+ base::MakeUnique<base::FundamentalValue>(could_update_notification));
if (!could_update_notification)
return false;
@@ -672,7 +674,7 @@ bool NotificationsClearFunction::RunNotificationsApi() {
CreateScopedIdentifier(extension_->id(), params_->notification_id),
NotificationUIManager::GetProfileID(GetProfile()));
- SetResult(new base::FundamentalValue(cancel_result));
+ SetResult(base::MakeUnique<base::FundamentalValue>(cancel_result));
SendResponse(true);
return true;
@@ -697,7 +699,7 @@ bool NotificationsGetAllFunction::RunNotificationsApi() {
StripScopeFromIdentifier(extension_->id(), *iter), true);
}
- SetResult(result.release());
+ SetResult(std::move(result));
SendResponse(true);
return true;
@@ -719,7 +721,8 @@ bool NotificationsGetPermissionLevelFunction::RunNotificationsApi() {
? api::notifications::PERMISSION_LEVEL_GRANTED
: api::notifications::PERMISSION_LEVEL_DENIED;
- SetResult(new base::StringValue(api::notifications::ToString(result)));
+ SetResult(base::MakeUnique<base::StringValue>(
+ api::notifications::ToString(result)));
SendResponse(true);
return true;

Powered by Google App Engine
This is Rietveld 408576698