| Index: chrome/browser/extensions/api/declarative_content/content_action.cc
|
| diff --git a/chrome/browser/extensions/api/declarative_content/content_action.cc b/chrome/browser/extensions/api/declarative_content/content_action.cc
|
| index 42f91b617574c01e633e64c36897f8f9897d15b6..d8e14973dda11026d9d6eead76381c6b429fc7df 100644
|
| --- a/chrome/browser/extensions/api/declarative_content/content_action.cc
|
| +++ b/chrome/browser/extensions/api/declarative_content/content_action.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/lazy_instance.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/extensions/api/declarative_content/content_constants.h"
|
| @@ -54,7 +55,7 @@ class ShowPageAction : public ContentAction {
|
| ShowPageAction() {}
|
| ~ShowPageAction() override {}
|
|
|
| - static scoped_ptr<ContentAction> Create(
|
| + static std::unique_ptr<ContentAction> Create(
|
| content::BrowserContext* browser_context,
|
| const Extension* extension,
|
| const base::DictionaryValue* dict,
|
| @@ -62,9 +63,9 @@ class ShowPageAction : public ContentAction {
|
| // We can't show a page action if the extension doesn't have one.
|
| if (ActionInfo::GetPageActionInfo(extension) == NULL) {
|
| *error = kNoPageAction;
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
| }
|
| - return make_scoped_ptr(new ShowPageAction);
|
| + return base::WrapUnique(new ShowPageAction);
|
| }
|
|
|
| // Implementation of ContentAction:
|
| @@ -104,7 +105,7 @@ class SetIcon : public ContentAction {
|
| : icon_(icon), action_type_(action_type) {}
|
| ~SetIcon() override {}
|
|
|
| - static scoped_ptr<ContentAction> Create(
|
| + static std::unique_ptr<ContentAction> Create(
|
| content::BrowserContext* browser_context,
|
| const Extension* extension,
|
| const base::DictionaryValue* dict,
|
| @@ -182,7 +183,7 @@ struct ContentActionFactory {
|
| // Factory methods for ContentAction instances. |extension| is the extension
|
| // for which the action is being created. |dict| contains the json dictionary
|
| // that describes the action. |error| is used to return error messages.
|
| - using FactoryMethod = scoped_ptr<ContentAction>(*)(
|
| + using FactoryMethod = std::unique_ptr<ContentAction> (*)(
|
| content::BrowserContext* /* browser_context */,
|
| const Extension* /* extension */,
|
| const base::DictionaryValue* /* dict */,
|
| @@ -226,21 +227,21 @@ RequestContentScript::ScriptData::ScriptData()
|
| RequestContentScript::ScriptData::~ScriptData() {}
|
|
|
| // static
|
| -scoped_ptr<ContentAction> RequestContentScript::Create(
|
| +std::unique_ptr<ContentAction> RequestContentScript::Create(
|
| content::BrowserContext* browser_context,
|
| const Extension* extension,
|
| const base::DictionaryValue* dict,
|
| std::string* error) {
|
| ScriptData script_data;
|
| if (!InitScriptData(dict, error, &script_data))
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
|
|
| - return make_scoped_ptr(new RequestContentScript(browser_context, extension,
|
| - script_data));
|
| + return base::WrapUnique(
|
| + new RequestContentScript(browser_context, extension, script_data));
|
| }
|
|
|
| // static
|
| -scoped_ptr<ContentAction> RequestContentScript::CreateForTest(
|
| +std::unique_ptr<ContentAction> RequestContentScript::CreateForTest(
|
| DeclarativeUserScriptMaster* master,
|
| const Extension* extension,
|
| const base::Value& json_action,
|
| @@ -253,17 +254,17 @@ scoped_ptr<ContentAction> RequestContentScript::CreateForTest(
|
| if (!(json_action.GetAsDictionary(&action_dict) &&
|
| action_dict->GetString(keys::kInstanceType, &instance_type) &&
|
| instance_type == std::string(keys::kRequestContentScript)))
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
|
|
| // Normal RequestContentScript data initialization.
|
| ScriptData script_data;
|
| if (!InitScriptData(action_dict, error, &script_data))
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
|
|
| // Inject provided DeclarativeUserScriptMaster, rather than looking it up
|
| // using a BrowserContext.
|
| - return make_scoped_ptr(new RequestContentScript(master, extension,
|
| - script_data));
|
| + return base::WrapUnique(
|
| + new RequestContentScript(master, extension, script_data));
|
| }
|
|
|
| // static
|
| @@ -381,7 +382,7 @@ void RequestContentScript::InstructRenderProcessToInject(
|
| }
|
|
|
| // static
|
| -scoped_ptr<ContentAction> SetIcon::Create(
|
| +std::unique_ptr<ContentAction> SetIcon::Create(
|
| content::BrowserContext* browser_context,
|
| const Extension* extension,
|
| const base::DictionaryValue* dict,
|
| @@ -394,7 +395,7 @@ scoped_ptr<ContentAction> SetIcon::Create(
|
| type = ActionInfo::TYPE_BROWSER;
|
| } else {
|
| *error = kNoPageOrBrowserAction;
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
| }
|
|
|
| gfx::ImageSkia icon;
|
| @@ -402,9 +403,9 @@ scoped_ptr<ContentAction> SetIcon::Create(
|
| if (dict->GetDictionary("imageData", &canvas_set) &&
|
| !ExtensionAction::ParseIconFromCanvasDictionary(*canvas_set, &icon)) {
|
| *error = kInvalidIconDictionary;
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
| }
|
| - return make_scoped_ptr(new SetIcon(gfx::Image(icon), type));
|
| + return base::WrapUnique(new SetIcon(gfx::Image(icon), type));
|
| }
|
|
|
| //
|
| @@ -414,7 +415,7 @@ scoped_ptr<ContentAction> SetIcon::Create(
|
| ContentAction::~ContentAction() {}
|
|
|
| // static
|
| -scoped_ptr<ContentAction> ContentAction::Create(
|
| +std::unique_ptr<ContentAction> ContentAction::Create(
|
| content::BrowserContext* browser_context,
|
| const Extension* extension,
|
| const base::Value& json_action,
|
| @@ -424,7 +425,7 @@ scoped_ptr<ContentAction> ContentAction::Create(
|
| std::string instance_type;
|
| if (!(json_action.GetAsDictionary(&action_dict) &&
|
| action_dict->GetString(keys::kInstanceType, &instance_type)))
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
|
|
| ContentActionFactory& factory = g_content_action_factory.Get();
|
| std::map<std::string, ContentActionFactory::FactoryMethod>::iterator
|
| @@ -434,7 +435,7 @@ scoped_ptr<ContentAction> ContentAction::Create(
|
| browser_context, extension, action_dict, error);
|
|
|
| *error = base::StringPrintf(kInvalidInstanceTypeError, instance_type.c_str());
|
| - return scoped_ptr<ContentAction>();
|
| + return std::unique_ptr<ContentAction>();
|
| }
|
|
|
| ContentAction::ContentAction() {}
|
|
|