diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-20 15:06:40 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-22 11:48:58 +0000 |
commit | daa093eea7c773db06799a13bd7e4e2e2a9f8f14 (patch) | |
tree | 96cc5e7b9194c1b29eab927730bfa419e7111c25 /chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc | |
parent | be59a35641616a4cf23c4a13fa0632624b021c1b (diff) |
BASELINE: Update Chromium to 63.0.3239.58
Change-Id: Ia93b322a00ba4dd4004f3bcf1254063ba90e1605
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 | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc index 6fcfcfddccd..86fe43dbd3b 100644 --- a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -77,7 +77,7 @@ bool SetOmniboxDefaultSuggestion( // omnibox::SuggestResult. dict->SetWithoutPathExpansion( kSuggestionContent, - base::MakeUnique<base::Value>(base::Value::Type::STRING)); + std::make_unique<base::Value>(base::Value::Type::STRING)); prefs->UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, std::move(dict)); @@ -96,9 +96,9 @@ std::string GetTemplateURLStringForExtension(const std::string& extension_id) { // static void ExtensionOmniboxEventRouter::OnInputStarted( Profile* profile, const std::string& extension_id) { - auto event = base::MakeUnique<Event>( + auto event = std::make_unique<Event>( events::OMNIBOX_ON_INPUT_STARTED, omnibox::OnInputStarted::kEventName, - base::MakeUnique<base::ListValue>(), profile); + std::make_unique<base::ListValue>(), profile); EventRouter::Get(profile) ->DispatchEventToExtension(extension_id, std::move(event)); } @@ -112,11 +112,11 @@ bool ExtensionOmniboxEventRouter::OnInputChanged( extension_id, omnibox::OnInputChanged::kEventName)) return false; - std::unique_ptr<base::ListValue> args(new base::ListValue()); - args->Set(0, base::MakeUnique<base::Value>(input)); - args->Set(1, base::MakeUnique<base::Value>(suggest_id)); + auto args(std::make_unique<base::ListValue>()); + args->Set(0, std::make_unique<base::Value>(input)); + args->Set(1, std::make_unique<base::Value>(suggest_id)); - auto event = base::MakeUnique<Event>(events::OMNIBOX_ON_INPUT_CHANGED, + auto event = std::make_unique<Event>(events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName, std::move(args), profile); event_router->DispatchEventToExtension(extension_id, std::move(event)); @@ -139,16 +139,16 @@ void ExtensionOmniboxEventRouter::OnInputEntered( extensions::TabHelper::FromWebContents(web_contents)-> active_tab_permission_granter()->GrantIfRequested(extension); - std::unique_ptr<base::ListValue> args(new base::ListValue()); - args->Set(0, base::MakeUnique<base::Value>(input)); + auto args(std::make_unique<base::ListValue>()); + args->Set(0, std::make_unique<base::Value>(input)); if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) - args->Set(1, base::MakeUnique<base::Value>(kForegroundTabDisposition)); + args->Set(1, std::make_unique<base::Value>(kForegroundTabDisposition)); else if (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) - args->Set(1, base::MakeUnique<base::Value>(kBackgroundTabDisposition)); + args->Set(1, std::make_unique<base::Value>(kBackgroundTabDisposition)); else - args->Set(1, base::MakeUnique<base::Value>(kCurrentTabDisposition)); + args->Set(1, std::make_unique<base::Value>(kCurrentTabDisposition)); - auto event = base::MakeUnique<Event>(events::OMNIBOX_ON_INPUT_ENTERED, + auto event = std::make_unique<Event>(events::OMNIBOX_ON_INPUT_ENTERED, omnibox::OnInputEntered::kEventName, std::move(args), profile); EventRouter::Get(profile) @@ -163,13 +163,28 @@ void ExtensionOmniboxEventRouter::OnInputEntered( // static void ExtensionOmniboxEventRouter::OnInputCancelled( Profile* profile, const std::string& extension_id) { - auto event = base::MakeUnique<Event>( + auto event = std::make_unique<Event>( events::OMNIBOX_ON_INPUT_CANCELLED, omnibox::OnInputCancelled::kEventName, - base::MakeUnique<base::ListValue>(), profile); + std::make_unique<base::ListValue>(), profile); EventRouter::Get(profile) ->DispatchEventToExtension(extension_id, std::move(event)); } +void ExtensionOmniboxEventRouter::OnDeleteSuggestion( + Profile* profile, + const std::string& extension_id, + const std::string& suggestion_text) { + auto args(std::make_unique<base::ListValue>()); + args->Set(0, std::make_unique<base::Value>(suggestion_text)); + + auto event = std::make_unique<Event>(events::OMNIBOX_ON_DELETE_SUGGESTION, + omnibox::OnDeleteSuggestion::kEventName, + std::move(args), profile); + + EventRouter::Get(profile)->DispatchEventToExtension(extension_id, + std::move(event)); +} + OmniboxAPI::OmniboxAPI(content::BrowserContext* context) : profile_(Profile::FromBrowserContext(context)), url_service_(TemplateURLServiceFactory::GetForProfile(profile_)), @@ -192,13 +207,12 @@ void OmniboxAPI::Shutdown() { OmniboxAPI::~OmniboxAPI() { } -static base::LazyInstance< - BrowserContextKeyedAPIFactory<OmniboxAPI>>::DestructorAtExit g_factory = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<BrowserContextKeyedAPIFactory<OmniboxAPI>>:: + DestructorAtExit g_omnibox_api_factory = LAZY_INSTANCE_INITIALIZER; // static BrowserContextKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { - return g_factory.Pointer(); + return g_omnibox_api_factory.Pointer(); } // static |