diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-12 14:07:37 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-17 10:29:26 +0000 |
commit | ec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch) | |
tree | 25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc | |
parent | bb09965444b5bb20b096a291445170876225268d (diff) |
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc')
-rw-r--r-- | chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc index b98495012a7..91a4bca7515 100644 --- a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chromium/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,10 +75,11 @@ 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::StringValue("")); - prefs->UpdateExtensionPref(extension_id, - kOmniboxDefaultSuggestion, - dict.release()); + dict->SetWithoutPathExpansion( + kSuggestionContent, + base::MakeUnique<base::Value>(base::Value::Type::STRING)); + prefs->UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, + std::move(dict)); return true; } @@ -112,8 +114,8 @@ bool ExtensionOmniboxEventRouter::OnInputChanged( return false; std::unique_ptr<base::ListValue> args(new base::ListValue()); - args->Set(0, new base::StringValue(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, @@ -140,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::StringValue(input)); + args->Set(0, base::MakeUnique<base::Value>(input)); if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) - args->Set(1, new base::StringValue(kForegroundTabDisposition)); + args->Set(1, base::MakeUnique<base::Value>(kForegroundTabDisposition)); else if (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) - args->Set(1, new base::StringValue(kBackgroundTabDisposition)); + args->Set(1, base::MakeUnique<base::Value>(kBackgroundTabDisposition)); else - args->Set(1, new base::StringValue(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, @@ -194,8 +196,9 @@ void OmniboxAPI::Shutdown() { OmniboxAPI::~OmniboxAPI() { } -static base::LazyInstance<BrowserContextKeyedAPIFactory<OmniboxAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<OmniboxAPI>>::DestructorAtExit g_factory = + LAZY_INSTANCE_INITIALIZER; // static BrowserContextKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { |