| 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 2349156d11cc65d5acc618b92ef281128ab28dd1..04ab949662f5d87a105f5f0cbc09c0b1f13eb9e8 100644
|
| --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
|
| +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
|
| @@ -5,9 +5,11 @@
|
| #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
|
|
|
| #include <stddef.h>
|
| +
|
| #include <utility>
|
|
|
| #include "base/lazy_instance.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/strings/string16.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "build/build_config.h"
|
| @@ -54,12 +56,12 @@ static const int kOmniboxIconPaddingLeft = 0;
|
| static const int kOmniboxIconPaddingRight = 0;
|
| #endif
|
|
|
| -scoped_ptr<omnibox::SuggestResult> GetOmniboxDefaultSuggestion(
|
| +std::unique_ptr<omnibox::SuggestResult> GetOmniboxDefaultSuggestion(
|
| Profile* profile,
|
| const std::string& extension_id) {
|
| ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
|
|
|
| - scoped_ptr<omnibox::SuggestResult> suggestion;
|
| + std::unique_ptr<omnibox::SuggestResult> suggestion;
|
| const base::DictionaryValue* dict = NULL;
|
| if (prefs && prefs->ReadPrefAsDictionary(extension_id,
|
| kOmniboxDefaultSuggestion,
|
| @@ -80,7 +82,7 @@ bool SetOmniboxDefaultSuggestion(
|
| if (!prefs)
|
| return false;
|
|
|
| - scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue();
|
| + 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(""));
|
| @@ -103,9 +105,9 @@ std::string GetTemplateURLStringForExtension(const std::string& extension_id) {
|
| // static
|
| void ExtensionOmniboxEventRouter::OnInputStarted(
|
| Profile* profile, const std::string& extension_id) {
|
| - scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_STARTED,
|
| - omnibox::OnInputStarted::kEventName,
|
| - make_scoped_ptr(new base::ListValue())));
|
| + std::unique_ptr<Event> event(new Event(
|
| + events::OMNIBOX_ON_INPUT_STARTED, omnibox::OnInputStarted::kEventName,
|
| + base::WrapUnique(new base::ListValue())));
|
| event->restrict_to_browser_context = profile;
|
| EventRouter::Get(profile)
|
| ->DispatchEventToExtension(extension_id, std::move(event));
|
| @@ -120,13 +122,13 @@ bool ExtensionOmniboxEventRouter::OnInputChanged(
|
| extension_id, omnibox::OnInputChanged::kEventName))
|
| return false;
|
|
|
| - scoped_ptr<base::ListValue> args(new base::ListValue());
|
| + std::unique_ptr<base::ListValue> args(new base::ListValue());
|
| args->Set(0, new base::StringValue(input));
|
| args->Set(1, new base::FundamentalValue(suggest_id));
|
|
|
| - scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CHANGED,
|
| - omnibox::OnInputChanged::kEventName,
|
| - std::move(args)));
|
| + std::unique_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CHANGED,
|
| + omnibox::OnInputChanged::kEventName,
|
| + std::move(args)));
|
| event->restrict_to_browser_context = profile;
|
| event_router->DispatchEventToExtension(extension_id, std::move(event));
|
| return true;
|
| @@ -148,7 +150,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
|
| extensions::TabHelper::FromWebContents(web_contents)->
|
| active_tab_permission_granter()->GrantIfRequested(extension);
|
|
|
| - scoped_ptr<base::ListValue> args(new base::ListValue());
|
| + std::unique_ptr<base::ListValue> args(new base::ListValue());
|
| args->Set(0, new base::StringValue(input));
|
| if (disposition == NEW_FOREGROUND_TAB)
|
| args->Set(1, new base::StringValue(kForegroundTabDisposition));
|
| @@ -157,9 +159,9 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
|
| else
|
| args->Set(1, new base::StringValue(kCurrentTabDisposition));
|
|
|
| - scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_ENTERED,
|
| - omnibox::OnInputEntered::kEventName,
|
| - std::move(args)));
|
| + std::unique_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_ENTERED,
|
| + omnibox::OnInputEntered::kEventName,
|
| + std::move(args)));
|
| event->restrict_to_browser_context = profile;
|
| EventRouter::Get(profile)
|
| ->DispatchEventToExtension(extension_id, std::move(event));
|
| @@ -173,9 +175,9 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
|
| // static
|
| void ExtensionOmniboxEventRouter::OnInputCancelled(
|
| Profile* profile, const std::string& extension_id) {
|
| - scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CANCELLED,
|
| - omnibox::OnInputCancelled::kEventName,
|
| - make_scoped_ptr(new base::ListValue())));
|
| + std::unique_ptr<Event> event(new Event(
|
| + events::OMNIBOX_ON_INPUT_CANCELLED, omnibox::OnInputCancelled::kEventName,
|
| + base::WrapUnique(new base::ListValue())));
|
| event->restrict_to_browser_context = profile;
|
| EventRouter::Get(profile)
|
| ->DispatchEventToExtension(extension_id, std::move(event));
|
| @@ -283,7 +285,7 @@ void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies() {
|
| }
|
|
|
| bool OmniboxSendSuggestionsFunction::RunSync() {
|
| - scoped_ptr<SendSuggestions::Params> params(
|
| + std::unique_ptr<SendSuggestions::Params> params(
|
| SendSuggestions::Params::Create(*args_));
|
| EXTENSION_FUNCTION_VALIDATE(params);
|
|
|
| @@ -296,7 +298,7 @@ bool OmniboxSendSuggestionsFunction::RunSync() {
|
| }
|
|
|
| bool OmniboxSetDefaultSuggestionFunction::RunSync() {
|
| - scoped_ptr<SetDefaultSuggestion::Params> params(
|
| + std::unique_ptr<SetDefaultSuggestion::Params> params(
|
| SetDefaultSuggestion::Params::Create(*args_));
|
| EXTENSION_FUNCTION_VALIDATE(params);
|
|
|
| @@ -368,7 +370,7 @@ void ApplyDefaultSuggestionForExtensionKeyword(
|
| AutocompleteMatch* match) {
|
| DCHECK(keyword->GetType() == TemplateURL::OMNIBOX_API_EXTENSION);
|
|
|
| - scoped_ptr<omnibox::SuggestResult> suggestion(
|
| + std::unique_ptr<omnibox::SuggestResult> suggestion(
|
| GetOmniboxDefaultSuggestion(profile, keyword->GetExtensionId()));
|
| if (!suggestion || suggestion->description.empty())
|
| return; // fall back to the universal default
|
|
|