| Index: chrome/common/extensions/manifest_handlers/automation.cc
|
| diff --git a/chrome/common/extensions/manifest_handlers/automation.cc b/chrome/common/extensions/manifest_handlers/automation.cc
|
| index 2e22cb38c4d0c9e46a408b1f9688eddca1640f9e..b53ab0c968020a145d22fd50f2894287d466407b 100644
|
| --- a/chrome/common/extensions/manifest_handlers/automation.cc
|
| +++ b/chrome/common/extensions/manifest_handlers/automation.cc
|
| @@ -4,8 +4,10 @@
|
|
|
| #include "chrome/common/extensions/manifest_handlers/automation.h"
|
|
|
| +#include <memory>
|
| #include <utility>
|
|
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/common/extensions/api/manifest_types.h"
|
| #include "chrome/grit/generated_resources.h"
|
| @@ -41,7 +43,7 @@ using api::manifest_types::Automation;
|
| class AutomationManifestPermission : public ManifestPermission {
|
| public:
|
| explicit AutomationManifestPermission(
|
| - scoped_ptr<const AutomationInfo> automation_info)
|
| + std::unique_ptr<const AutomationInfo> automation_info)
|
| : automation_info_(std::move(automation_info)) {}
|
|
|
| // extensions::ManifestPermission overrides.
|
| @@ -53,7 +55,7 @@ class AutomationManifestPermission : public ManifestPermission {
|
|
|
| bool FromValue(const base::Value* value) override;
|
|
|
| - scoped_ptr<base::Value> ToValue() const override;
|
| + std::unique_ptr<base::Value> ToValue() const override;
|
|
|
| ManifestPermission* Diff(const ManifestPermission* rhs) const override;
|
|
|
| @@ -62,7 +64,7 @@ class AutomationManifestPermission : public ManifestPermission {
|
| ManifestPermission* Intersect(const ManifestPermission* rhs) const override;
|
|
|
| private:
|
| - scoped_ptr<const AutomationInfo> automation_info_;
|
| + std::unique_ptr<const AutomationInfo> automation_info_;
|
| };
|
|
|
| std::string AutomationManifestPermission::name() const {
|
| @@ -108,7 +110,7 @@ bool AutomationManifestPermission::FromValue(const base::Value* value) {
|
| return error.empty();
|
| }
|
|
|
| -scoped_ptr<base::Value> AutomationManifestPermission::ToValue() const {
|
| +std::unique_ptr<base::Value> AutomationManifestPermission::ToValue() const {
|
| return AutomationInfo::ToValue(*automation_info_);
|
| }
|
|
|
| @@ -123,7 +125,7 @@ ManifestPermission* AutomationManifestPermission::Diff(
|
| URLPatternSet matches = URLPatternSet::CreateDifference(
|
| automation_info_->matches, other->automation_info_->matches);
|
| return new AutomationManifestPermission(
|
| - make_scoped_ptr(new const AutomationInfo(desktop, matches, interact)));
|
| + base::WrapUnique(new const AutomationInfo(desktop, matches, interact)));
|
| }
|
|
|
| ManifestPermission* AutomationManifestPermission::Union(
|
| @@ -137,7 +139,7 @@ ManifestPermission* AutomationManifestPermission::Union(
|
| URLPatternSet matches = URLPatternSet::CreateUnion(
|
| automation_info_->matches, other->automation_info_->matches);
|
| return new AutomationManifestPermission(
|
| - make_scoped_ptr(new const AutomationInfo(desktop, matches, interact)));
|
| + base::WrapUnique(new const AutomationInfo(desktop, matches, interact)));
|
| }
|
|
|
| ManifestPermission* AutomationManifestPermission::Intersect(
|
| @@ -151,7 +153,7 @@ ManifestPermission* AutomationManifestPermission::Intersect(
|
| URLPatternSet matches = URLPatternSet::CreateIntersection(
|
| automation_info_->matches, other->automation_info_->matches);
|
| return new AutomationManifestPermission(
|
| - make_scoped_ptr(new const AutomationInfo(desktop, matches, interact)));
|
| + base::WrapUnique(new const AutomationInfo(desktop, matches, interact)));
|
| }
|
|
|
| AutomationHandler::AutomationHandler() {
|
| @@ -164,7 +166,7 @@ bool AutomationHandler::Parse(Extension* extension, base::string16* error) {
|
| const base::Value* automation = NULL;
|
| CHECK(extension->manifest()->Get(keys::kAutomation, &automation));
|
| std::vector<InstallWarning> install_warnings;
|
| - scoped_ptr<AutomationInfo> info =
|
| + std::unique_ptr<AutomationInfo> info =
|
| AutomationInfo::FromValue(*automation, &install_warnings, error);
|
| if (!error->empty())
|
| return false;
|
| @@ -184,7 +186,7 @@ const std::vector<std::string> AutomationHandler::Keys() const {
|
|
|
| ManifestPermission* AutomationHandler::CreatePermission() {
|
| return new AutomationManifestPermission(
|
| - make_scoped_ptr(new const AutomationInfo));
|
| + base::WrapUnique(new const AutomationInfo));
|
| }
|
|
|
| ManifestPermission* AutomationHandler::CreateInitialRequiredPermission(
|
| @@ -192,8 +194,8 @@ ManifestPermission* AutomationHandler::CreateInitialRequiredPermission(
|
| const AutomationInfo* info = AutomationInfo::Get(extension);
|
| if (info) {
|
| return new AutomationManifestPermission(
|
| - make_scoped_ptr(new const AutomationInfo(
|
| - info->desktop, info->matches, info->interact)));
|
| + base::WrapUnique(new const AutomationInfo(info->desktop, info->matches,
|
| + info->interact)));
|
| }
|
| return NULL;
|
| }
|
| @@ -205,18 +207,18 @@ const AutomationInfo* AutomationInfo::Get(const Extension* extension) {
|
| }
|
|
|
| // static
|
| -scoped_ptr<AutomationInfo> AutomationInfo::FromValue(
|
| +std::unique_ptr<AutomationInfo> AutomationInfo::FromValue(
|
| const base::Value& value,
|
| std::vector<InstallWarning>* install_warnings,
|
| base::string16* error) {
|
| - scoped_ptr<Automation> automation = Automation::FromValue(value, error);
|
| + std::unique_ptr<Automation> automation = Automation::FromValue(value, error);
|
| if (!automation)
|
| - return scoped_ptr<AutomationInfo>();
|
| + return std::unique_ptr<AutomationInfo>();
|
|
|
| if (automation->as_boolean) {
|
| if (*automation->as_boolean)
|
| - return make_scoped_ptr(new AutomationInfo());
|
| - return scoped_ptr<AutomationInfo>();
|
| + return base::WrapUnique(new AutomationInfo());
|
| + return std::unique_ptr<AutomationInfo>();
|
| }
|
| const Automation::Object& automation_object = *automation->as_object;
|
|
|
| @@ -272,18 +274,19 @@ scoped_ptr<AutomationInfo> AutomationInfo::FromValue(
|
| InstallWarning(automation_errors::kErrorNoMatchesProvided));
|
| }
|
|
|
| - return make_scoped_ptr(new AutomationInfo(desktop, matches, interact));
|
| + return base::WrapUnique(new AutomationInfo(desktop, matches, interact));
|
| }
|
|
|
| // static
|
| -scoped_ptr<base::Value> AutomationInfo::ToValue(const AutomationInfo& info) {
|
| +std::unique_ptr<base::Value> AutomationInfo::ToValue(
|
| + const AutomationInfo& info) {
|
| return AsManifestType(info)->ToValue();
|
| }
|
|
|
| // static
|
| -scoped_ptr<Automation> AutomationInfo::AsManifestType(
|
| +std::unique_ptr<Automation> AutomationInfo::AsManifestType(
|
| const AutomationInfo& info) {
|
| - scoped_ptr<Automation> automation(new Automation);
|
| + std::unique_ptr<Automation> automation(new Automation);
|
| if (!info.desktop && !info.interact && info.matches.size() == 0) {
|
| automation->as_boolean.reset(new bool(true));
|
| return automation;
|
|
|