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, ¶ms_->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, ¶ms_->options, ¬ification); |
- 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; |