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

Unified Diff: chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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/input_ime/input_ime_api_chromeos.cc
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
index dcba0719ce672b67eb813c873be18dc957b3b798..31cb78372e0dd4418c9896338320a666cf8d818f 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/macros.h"
@@ -160,14 +162,14 @@ class ImeObserverChromeOS : public ui::ImeObserver {
return;
// Note: this is a private API event.
- base::ListValue* bounds_list = new base::ListValue();
+ auto bounds_list = base::MakeUnique<base::ListValue>();
for (size_t i = 0; i < bounds.size(); ++i) {
- base::DictionaryValue* bounds_value = new base::DictionaryValue();
+ auto bounds_value = base::MakeUnique<base::DictionaryValue>();
bounds_value->SetInteger("x", bounds[i].x());
bounds_value->SetInteger("y", bounds[i].y());
bounds_value->SetInteger("w", bounds[i].width());
bounds_value->SetInteger("h", bounds[i].height());
- bounds_list->Append(bounds_value);
+ bounds_list->Append(std::move(bounds_value));
}
if (bounds_list->GetSize() <= 0)
@@ -179,7 +181,7 @@ class ImeObserverChromeOS : public ui::ImeObserver {
base::Value* first_value = NULL;
if (bounds_list->Get(0, &first_value))
args->Append(first_value->DeepCopy());
- args->Append(bounds_list);
+ args->Append(std::move(bounds_list));
DispatchEventToExtension(
extensions::events::INPUT_METHOD_PRIVATE_ON_COMPOSITION_BOUNDS_CHANGED,

Powered by Google App Engine
This is Rietveld 408576698