diff options
author | dcheng <dcheng@chromium.org> | 2015-12-18 09:48:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 17:48:52 +0000 |
commit | e59eca16010c109a5e3e4922189c8b264d34caa9 (patch) | |
tree | 838815399c6364a99a465938df9978aeaf75c766 /extensions/common/manifest_handlers | |
parent | 5100baf1eac806abbdaaf8002887aacf652f34e5 (diff) | |
download | chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.zip chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.tar.gz chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.tar.bz2 |
Convert Pass()→std::move() in //extensions
BUG=557422
Review URL: https://codereview.chromium.org/1537893002
Cr-Commit-Position: refs/heads/master@{#366120}
Diffstat (limited to 'extensions/common/manifest_handlers')
3 files changed, 27 insertions, 20 deletions
diff --git a/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc b/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc index e52a103..f09c971 100644 --- a/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/test/values_test_util.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" @@ -156,7 +158,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -166,7 +168,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -179,7 +181,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -192,7 +194,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -205,7 +207,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -215,7 +217,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -225,7 +227,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -235,7 +237,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; scoped_refptr<extensions::Extension> extension = LoadExtension(manifest, &error); @@ -248,7 +250,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -256,7 +258,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -267,7 +269,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -277,7 +279,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -289,7 +291,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -298,7 +300,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -308,7 +310,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); diff --git a/extensions/common/manifest_handlers/permissions_parser.cc b/extensions/common/manifest_handlers/permissions_parser.cc index a7c6db9..2afdf72 100644 --- a/extensions/common/manifest_handlers/permissions_parser.cc +++ b/extensions/common/manifest_handlers/permissions_parser.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest_handlers/permissions_parser.h" +#include <utility> + #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/strings/utf_string_conversions.h" @@ -40,7 +42,7 @@ struct ManifestPermissions : public Extension::ManifestData { ManifestPermissions::ManifestPermissions( scoped_ptr<const PermissionSet> permissions) - : permissions(permissions.Pass()) {} + : permissions(std::move(permissions)) {} ManifestPermissions::~ManifestPermissions() { } @@ -272,7 +274,8 @@ void PermissionsParser::Finalize(Extension* extension) { initial_required_permissions_->host_permissions, initial_required_permissions_->scriptable_hosts)); extension->SetManifestData( - keys::kPermissions, new ManifestPermissions(required_permissions.Pass())); + keys::kPermissions, + new ManifestPermissions(std::move(required_permissions))); scoped_ptr<const PermissionSet> optional_permissions(new PermissionSet( initial_optional_permissions_->api_permissions, @@ -280,7 +283,7 @@ void PermissionsParser::Finalize(Extension* extension) { initial_optional_permissions_->host_permissions, URLPatternSet())); extension->SetManifestData( keys::kOptionalPermissions, - new ManifestPermissions(optional_permissions.Pass())); + new ManifestPermissions(std::move(optional_permissions))); } // static diff --git a/extensions/common/manifest_handlers/webview_info.cc b/extensions/common/manifest_handlers/webview_info.cc index 12bafcc..f66df27 100644 --- a/extensions/common/manifest_handlers/webview_info.cc +++ b/extensions/common/manifest_handlers/webview_info.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest_handlers/webview_info.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/strings/pattern.h" #include "base/strings/string_number_conversions.h" @@ -83,7 +85,7 @@ bool WebviewInfo::IsResourceWebviewAccessible( } void WebviewInfo::AddPartitionItem(scoped_ptr<PartitionItem> item) { - partition_items_.push_back(item.Pass()); + partition_items_.push_back(std::move(item)); } WebviewHandler::WebviewHandler() { @@ -159,7 +161,7 @@ bool WebviewHandler::Parse(Extension* extension, base::string16* error) { relative_path).spec()); partition_item->AddPattern(pattern); } - info->AddPartitionItem(partition_item.Pass()); + info->AddPartitionItem(std::move(partition_item)); } extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); |