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

Unified Diff: chrome/browser/extensions/api/omnibox/omnibox_api.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased 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/extensions/api/omnibox/omnibox_api.cc
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index b37d22d9832384b37e9256c310e672a31f27e43c..91a4bca751543cd87882ea7d2f957b82b6c70f33 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -12,6 +12,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
@@ -74,7 +75,9 @@ bool SetOmniboxDefaultSuggestion(
std::unique_ptr<base::DictionaryValue> dict = suggestion.ToValue();
// Add the content field so that the dictionary can be used to populate an
// omnibox::SuggestResult.
- dict->SetWithoutPathExpansion(kSuggestionContent, new base::Value(""));
+ dict->SetWithoutPathExpansion(
+ kSuggestionContent,
+ base::MakeUnique<base::Value>(base::Value::Type::STRING));
prefs->UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion,
std::move(dict));
@@ -111,8 +114,8 @@ bool ExtensionOmniboxEventRouter::OnInputChanged(
return false;
std::unique_ptr<base::ListValue> args(new base::ListValue());
- args->Set(0, new base::Value(input));
- args->Set(1, new base::Value(suggest_id));
+ args->Set(0, base::MakeUnique<base::Value>(input));
+ args->Set(1, base::MakeUnique<base::Value>(suggest_id));
std::unique_ptr<Event> event = base::MakeUnique<Event>(
events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName,
@@ -139,13 +142,13 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
active_tab_permission_granter()->GrantIfRequested(extension);
std::unique_ptr<base::ListValue> args(new base::ListValue());
- args->Set(0, new base::Value(input));
+ args->Set(0, base::MakeUnique<base::Value>(input));
if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB)
- args->Set(1, new base::Value(kForegroundTabDisposition));
+ args->Set(1, base::MakeUnique<base::Value>(kForegroundTabDisposition));
else if (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB)
- args->Set(1, new base::Value(kBackgroundTabDisposition));
+ args->Set(1, base::MakeUnique<base::Value>(kBackgroundTabDisposition));
else
- args->Set(1, new base::Value(kCurrentTabDisposition));
+ args->Set(1, base::MakeUnique<base::Value>(kCurrentTabDisposition));
std::unique_ptr<Event> event = base::MakeUnique<Event>(
events::OMNIBOX_ON_INPUT_ENTERED, omnibox::OnInputEntered::kEventName,

Powered by Google App Engine
This is Rietveld 408576698