summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorlimasdf <limasdf@gmail.com>2015-12-19 04:04:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-19 12:06:04 +0000
commit21d67e679792a286c581f20ea8e4848b9c34061e (patch)
treedc6783b7a0229c79e3a8514293fc874eb0fa4789 /extensions
parent49f72db8dbff60fb22dfddf09dddeffe54f674db (diff)
downloadchromium_src-21d67e679792a286c581f20ea8e4848b9c34061e.zip
chromium_src-21d67e679792a286c581f20ea8e4848b9c34061e.tar.gz
chromium_src-21d67e679792a286c581f20ea8e4848b9c34061e.tar.bz2
Use rvalue reference instead of extensions::DictionaryBuilder::pass()
C++ 11 enables rvalue reference with std::move() so that removing DictionaryBuilder::Pass(). BUG=563649 TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1532193003 Cr-Commit-Position: refs/heads/master@{#366280}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc8
-rw-r--r--extensions/browser/api/device_permissions_prompt_unittest.cc16
-rw-r--r--extensions/browser/api_unittest.cc11
-rw-r--r--extensions/browser/app_window/app_window_geometry_cache_unittest.cc8
-rw-r--r--extensions/browser/lazy_background_task_queue_unittest.cc39
-rw-r--r--extensions/browser/mojo/keep_alive_impl_unittest.cc29
-rw-r--r--extensions/browser/runtime_data_unittest.cc11
-rw-r--r--extensions/browser/updater/update_service_unittest.cc8
-rw-r--r--extensions/browser/value_store/value_store_change_unittest.cc31
-rw-r--r--extensions/common/extension_builder.h2
-rw-r--r--extensions/common/features/base_feature_provider_unittest.cc19
-rw-r--r--extensions/common/manifest_handler_unittest.cc44
-rw-r--r--extensions/common/test_util.cc24
-rw-r--r--extensions/common/value_builder.cc12
-rw-r--r--extensions/common/value_builder.h11
-rw-r--r--extensions/shell/browser/api/identity/identity_api_unittest.cc19
-rw-r--r--extensions/shell/browser/shell_native_app_window_aura_unittest.cc8
17 files changed, 158 insertions, 142 deletions
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
index d960a5f..701a28d 100644
--- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -83,10 +83,10 @@ TEST_F(BluetoothEventRouterTest, MultipleBluetoothEventListeners) {
TEST_F(BluetoothEventRouterTest, UnloadExtension) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "BT event router test")
- .Set("version", "1.0")
- .Set("manifest_version", 2))
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "BT event router test")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)))
.SetID(kTestExtensionId)
.Build();
diff --git a/extensions/browser/api/device_permissions_prompt_unittest.cc b/extensions/browser/api/device_permissions_prompt_unittest.cc
index 2ab430d..9c2d22c 100644
--- a/extensions/browser/api/device_permissions_prompt_unittest.cc
+++ b/extensions/browser/api/device_permissions_prompt_unittest.cc
@@ -19,10 +19,10 @@ class DevicePermissionsPromptTest : public testing::Test {};
TEST_F(DevicePermissionsPromptTest, HidPromptMessages) {
scoped_refptr<Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "Test Application")
- .Set("manifest_version", 2)
- .Set("version", "1.0"))
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "Test Application")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")))
.Build();
scoped_refptr<DevicePermissionsPrompt::Prompt> prompt =
@@ -47,10 +47,10 @@ TEST_F(DevicePermissionsPromptTest, HidPromptMessages) {
TEST_F(DevicePermissionsPromptTest, UsbPromptMessages) {
scoped_refptr<Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "Test Application")
- .Set("manifest_version", 2)
- .Set("version", "1.0"))
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "Test Application")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")))
.Build();
scoped_refptr<DevicePermissionsPrompt::Prompt> prompt =
diff --git a/extensions/browser/api_unittest.cc b/extensions/browser/api_unittest.cc
index d50a98b..f0c0f61 100644
--- a/extensions/browser/api_unittest.cc
+++ b/extensions/browser/api_unittest.cc
@@ -44,11 +44,12 @@ void ApiUnitTest::SetUp() {
content::TestBrowserThreadBundle::DEFAULT));
user_prefs::UserPrefs::Set(browser_context(), &testing_pref_service_);
- extension_ = ExtensionBuilder()
- .SetManifest(DictionaryBuilder().Set("name", "Test").Set(
- "version", "1.0"))
- .SetLocation(Manifest::UNPACKED)
- .Build();
+ extension_ =
+ ExtensionBuilder()
+ .SetManifest(std::move(
+ DictionaryBuilder().Set("name", "Test").Set("version", "1.0")))
+ .SetLocation(Manifest::UNPACKED)
+ .Build();
}
void ApiUnitTest::CreateBackgroundPage() {
diff --git a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
index 426d4af..9aef229 100644
--- a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
+++ b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
@@ -34,8 +34,8 @@ const char kWindowId2[] = "windowid2";
// Create a very simple extension with id.
scoped_refptr<Extension> CreateExtension(const std::string& id) {
return ExtensionBuilder()
- .SetManifest(DictionaryBuilder().Set("name", "test").Set(
- "version", "0.1"))
+ .SetManifest(std::move(
+ DictionaryBuilder().Set("name", "test").Set("version", "0.1")))
.SetID(id)
.Build();
}
@@ -161,8 +161,8 @@ std::string AppWindowGeometryCacheTest::AddExtensionWithPrefs(
browser_context()->GetPath().AppendASCII("Extensions").AppendASCII(name);
scoped_refptr<Extension> extension =
ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
+ .SetManifest(std::move(
+ DictionaryBuilder().Set("name", "test").Set("version", "0.1")))
.SetPath(path)
.Build();
diff --git a/extensions/browser/lazy_background_task_queue_unittest.cc b/extensions/browser/lazy_background_task_queue_unittest.cc
index 0dc103b..e7f1f8b 100644
--- a/extensions/browser/lazy_background_task_queue_unittest.cc
+++ b/extensions/browser/lazy_background_task_queue_unittest.cc
@@ -79,30 +79,33 @@ class LazyBackgroundTaskQueueTest : public ExtensionsTest {
// Creates and registers an extension without a background page.
scoped_refptr<Extension> CreateSimpleExtension() {
- scoped_refptr<Extension> extension = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "No background")
- .Set("version", "1")
- .Set("manifest_version", 2))
- .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
- .Build();
+ scoped_refptr<Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "No background")
+ .Set("version", "1")
+ .Set("manifest_version", 2)))
+ .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
+ .Build();
ExtensionRegistry::Get(browser_context())->AddEnabled(extension);
return extension;
}
// Creates and registers an extension with a lazy background page.
scoped_refptr<Extension> CreateLazyBackgroundExtension() {
- scoped_refptr<Extension> extension = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "Lazy background")
- .Set("version", "1")
- .Set("manifest_version", 2)
- .Set("background",
- DictionaryBuilder()
- .Set("page", "background.html")
- .SetBoolean("persistent", false)))
- .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
- .Build();
+ scoped_refptr<Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(std::move(
+ DictionaryBuilder()
+ .Set("name", "Lazy background")
+ .Set("version", "1")
+ .Set("manifest_version", 2)
+ .Set("background",
+ std::move(DictionaryBuilder()
+ .Set("page", "background.html")
+ .SetBoolean("persistent", false)))))
+ .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
+ .Build();
ExtensionRegistry::Get(browser_context())->AddEnabled(extension);
return extension;
}
diff --git a/extensions/browser/mojo/keep_alive_impl_unittest.cc b/extensions/browser/mojo/keep_alive_impl_unittest.cc
index 92bd9dd..7319875 100644
--- a/extensions/browser/mojo/keep_alive_impl_unittest.cc
+++ b/extensions/browser/mojo/keep_alive_impl_unittest.cc
@@ -27,16 +27,17 @@ class KeepAliveTest : public ExtensionsTest {
message_loop_.reset(new base::MessageLoop);
extension_ =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "app")
- .Set("version", "1")
- .Set("manifest_version", 2)
- .Set("app", DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts",
- std::move(ListBuilder().Append(
- "background.js"))))))
+ .SetManifest(std::move(
+ DictionaryBuilder()
+ .Set("name", "app")
+ .Set("version", "1")
+ .Set("manifest_version", 2)
+ .Set("app",
+ std::move(DictionaryBuilder().Set(
+ "background",
+ std::move(DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append(
+ "background.js")))))))))
.SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
.Build();
}
@@ -108,16 +109,16 @@ TEST_F(KeepAliveTest, UnloadExtension) {
scoped_refptr<const Extension> other_extension =
ExtensionBuilder()
- .SetManifest(
+ .SetManifest(std::move(
DictionaryBuilder()
.Set("name", "app")
.Set("version", "1")
.Set("manifest_version", 2)
- .Set("app", DictionaryBuilder().Set(
+ .Set("app", std::move(DictionaryBuilder().Set(
"background",
- DictionaryBuilder().Set(
+ std::move(DictionaryBuilder().Set(
"scripts", std::move(ListBuilder().Append(
- "background.js"))))))
+ "background.js")))))))))
.SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
.Build();
diff --git a/extensions/browser/runtime_data_unittest.cc b/extensions/browser/runtime_data_unittest.cc
index bec1e13..cb3ed8d7 100644
--- a/extensions/browser/runtime_data_unittest.cc
+++ b/extensions/browser/runtime_data_unittest.cc
@@ -20,11 +20,12 @@ namespace {
// Creates a very simple extension with a background page.
scoped_refptr<Extension> CreateExtensionWithBackgroundPage() {
return ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "test")
- .Set("version", "0.1")
- .Set("background", DictionaryBuilder().Set("page", "bg.html")))
+ .SetManifest(std::move(
+ DictionaryBuilder()
+ .Set("name", "test")
+ .Set("version", "0.1")
+ .Set("background",
+ std::move(DictionaryBuilder().Set("page", "bg.html")))))
.SetID("id2")
.Build();
}
diff --git a/extensions/browser/updater/update_service_unittest.cc b/extensions/browser/updater/update_service_unittest.cc
index fe2aefe..2ce4b95 100644
--- a/extensions/browser/updater/update_service_unittest.cc
+++ b/extensions/browser/updater/update_service_unittest.cc
@@ -178,10 +178,10 @@ TEST_F(UpdateServiceTest, BasicUpdateOperations) {
ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), bar_html, "world"));
ExtensionBuilder builder;
- builder.SetManifest(DictionaryBuilder()
- .Set("name", "Foo")
- .Set("version", "1.0")
- .Set("manifest_version", 2));
+ builder.SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "Foo")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)));
builder.SetID(crx_file::id_util::GenerateId("whatever"));
builder.SetPath(temp_dir.path());
diff --git a/extensions/browser/value_store/value_store_change_unittest.cc b/extensions/browser/value_store/value_store_change_unittest.cc
index 9da1f64..123385b 100644
--- a/extensions/browser/value_store/value_store_change_unittest.cc
+++ b/extensions/browser/value_store/value_store_change_unittest.cc
@@ -57,13 +57,13 @@ TEST(ValueStoreChangeTest, NonNullValues) {
TEST(ValueStoreChangeTest, ToJson) {
// Create a mildly complicated structure that has dots in it.
- scoped_ptr<base::DictionaryValue> value = DictionaryBuilder()
- .Set("key", "value")
- .Set("key.with.dots", "value.with.dots")
- .Set("tricked", DictionaryBuilder()
- .Set("you", "nodots"))
- .Set("tricked.you", "with.dots")
- .Build();
+ scoped_ptr<base::DictionaryValue> value =
+ DictionaryBuilder()
+ .Set("key", "value")
+ .Set("key.with.dots", "value.with.dots")
+ .Set("tricked", std::move(DictionaryBuilder().Set("you", "nodots")))
+ .Set("tricked.you", "with.dots")
+ .Build();
ValueStoreChangeList change_list;
change_list.push_back(
@@ -79,14 +79,15 @@ TEST(ValueStoreChangeTest, ToJson) {
DictionaryBuilder v2(*value);
DictionaryBuilder v3(*value);
DictionaryBuilder v4(*value);
- scoped_ptr<base::DictionaryValue> expected_from_json = DictionaryBuilder()
- .Set("key", DictionaryBuilder()
- .Set("oldValue", v1)
- .Set("newValue", v2))
- .Set("key.with.dots", DictionaryBuilder()
- .Set("oldValue", v3)
- .Set("newValue", v4))
- .Build();
+ scoped_ptr<base::DictionaryValue> expected_from_json =
+ DictionaryBuilder()
+ .Set("key", std::move(DictionaryBuilder()
+ .Set("oldValue", std::move(v1))
+ .Set("newValue", std::move(v2))))
+ .Set("key.with.dots", std::move(DictionaryBuilder()
+ .Set("oldValue", std::move(v3))
+ .Set("newValue", std::move(v4))))
+ .Build();
EXPECT_TRUE(from_json->Equals(expected_from_json.get()));
}
diff --git a/extensions/common/extension_builder.h b/extensions/common/extension_builder.h
index 96c81d2..3ceda07 100644
--- a/extensions/common/extension_builder.h
+++ b/extensions/common/extension_builder.h
@@ -39,7 +39,7 @@ class ExtensionBuilder {
ExtensionBuilder& SetLocation(Manifest::Location location);
ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest);
- ExtensionBuilder& SetManifest(DictionaryBuilder& manifest_builder) {
+ ExtensionBuilder& SetManifest(DictionaryBuilder manifest_builder) {
return SetManifest(manifest_builder.Build());
}
diff --git a/extensions/common/features/base_feature_provider_unittest.cc b/extensions/common/features/base_feature_provider_unittest.cc
index 30850a3..43e0ce2 100644
--- a/extensions/common/features/base_feature_provider_unittest.cc
+++ b/extensions/common/features/base_feature_provider_unittest.cc
@@ -46,10 +46,10 @@ TEST(BaseFeatureProviderTest, ManifestFeatureAvailability) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "test extension")
- .Set("version", "1")
- .Set("description", "hello there"))
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "test extension")
+ .Set("version", "1")
+ .Set("description", "hello there")))
.Build();
ASSERT_TRUE(extension.get());
@@ -100,16 +100,17 @@ TEST(BaseFeatureProviderTest, PermissionFeatureAvailability) {
scoped_refptr<const Extension> app =
ExtensionBuilder()
- .SetManifest(
+ .SetManifest(std::move(
DictionaryBuilder()
.Set("name", "test app")
.Set("version", "1")
- .Set("app", DictionaryBuilder().Set(
+ .Set("app", std::move(DictionaryBuilder().Set(
"background",
- DictionaryBuilder().Set(
+ std::move(DictionaryBuilder().Set(
"scripts", std::move(ListBuilder().Append(
- "background.js")))))
- .Set("permissions", std::move(ListBuilder().Append("power"))))
+ "background.js")))))))
+ .Set("permissions",
+ std::move(ListBuilder().Append("power")))))
.Build();
ASSERT_TRUE(app.get());
ASSERT_TRUE(app->is_platform_app());
diff --git a/extensions/common/manifest_handler_unittest.cc b/extensions/common/manifest_handler_unittest.cc
index 4c31c99..a014dae 100644
--- a/extensions/common/manifest_handler_unittest.cc
+++ b/extensions/common/manifest_handler_unittest.cc
@@ -182,19 +182,20 @@ TEST_F(ManifestHandlerTest, DependentHandlers) {
Register();
ManifestHandler::FinalizeRegistration();
- scoped_refptr<Extension> extension = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "no name")
- .Set("version", "0")
- .Set("manifest_version", 2)
- .Set("a", 1)
- .Set("b", 2)
- .Set("c", DictionaryBuilder()
- .Set("d", 3)
- .Set("e", 4)
- .Set("f", 5))
- .Set("g", 6))
- .Build();
+ scoped_refptr<Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(std::move(
+ DictionaryBuilder()
+ .Set("name", "no name")
+ .Set("version", "0")
+ .Set("manifest_version", 2)
+ .Set("a", 1)
+ .Set("b", 2)
+ .Set("c", std::move(
+ DictionaryBuilder().Set("d", 3).Set("e", 4).Set(
+ "f", 5)))
+ .Set("g", 6)))
+ .Build();
// A, B, C.EZ, C.D, K
EXPECT_EQ(5u, watcher.parsed_names().size());
@@ -243,14 +244,15 @@ TEST_F(ManifestHandlerTest, FailingHandlers) {
TEST_F(ManifestHandlerTest, Validate) {
ScopedTestingManifestHandlerRegistry registry;
- scoped_refptr<Extension> extension = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "no name")
- .Set("version", "0")
- .Set("manifest_version", 2)
- .Set("a", 1)
- .Set("b", 2))
- .Build();
+ scoped_refptr<Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "no name")
+ .Set("version", "0")
+ .Set("manifest_version", 2)
+ .Set("a", 1)
+ .Set("b", 2)))
+ .Build();
EXPECT_TRUE(extension.get());
std::string error;
diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc
index eb857fd..e3775e5 100644
--- a/extensions/common/test_util.cc
+++ b/extensions/common/test_util.cc
@@ -14,39 +14,39 @@ namespace extensions {
namespace test_util {
ExtensionBuilder BuildExtension(ExtensionBuilder builder) {
- builder.SetManifest(DictionaryBuilder()
- .Set("name", "Test extension")
- .Set("version", "1.0")
- .Set("manifest_version", 2));
+ builder.SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "Test extension")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)));
return builder;
}
ExtensionBuilder BuildApp(ExtensionBuilder builder) {
- builder.SetManifest(
+ builder.SetManifest(std::move(
DictionaryBuilder()
.Set("name", "Test extension")
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("app",
- extensions::DictionaryBuilder().Set(
+ std::move(extensions::DictionaryBuilder().Set(
"background",
- extensions::DictionaryBuilder().Set(
+ std::move(extensions::DictionaryBuilder().Set(
"scripts", std::move(extensions::ListBuilder().Append(
- "background.js"))))));
+ "background.js")))))))));
return builder;
}
scoped_refptr<Extension> CreateEmptyExtension() {
return ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))
+ .SetManifest(std::move(
+ DictionaryBuilder().Set("name", "Test").Set("version", "1.0")))
.Build();
}
scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) {
return ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
+ .SetManifest(std::move(
+ DictionaryBuilder().Set("name", "test").Set("version", "0.1")))
.SetID(id)
.Build();
}
diff --git a/extensions/common/value_builder.cc b/extensions/common/value_builder.cc
index 89c3ec3..987bbb4 100644
--- a/extensions/common/value_builder.cc
+++ b/extensions/common/value_builder.cc
@@ -20,6 +20,14 @@ DictionaryBuilder::DictionaryBuilder(const base::DictionaryValue& init)
DictionaryBuilder::~DictionaryBuilder() {}
+DictionaryBuilder::DictionaryBuilder(DictionaryBuilder&& other)
+ : dict_(other.Build()) {}
+
+DictionaryBuilder& DictionaryBuilder::operator=(DictionaryBuilder&& other) {
+ dict_ = other.Build();
+ return *this;
+}
+
std::string DictionaryBuilder::ToJSON() const {
std::string json;
base::JSONWriter::WriteWithOptions(
@@ -52,7 +60,7 @@ DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
- DictionaryBuilder& in_value) {
+ DictionaryBuilder in_value) {
dict_->SetWithoutPathExpansion(path, in_value.Build());
return *this;
}
@@ -110,7 +118,7 @@ ListBuilder& ListBuilder::Append(const base::string16& in_value) {
return *this;
}
-ListBuilder& ListBuilder::Append(DictionaryBuilder& in_value) {
+ListBuilder& ListBuilder::Append(DictionaryBuilder in_value) {
list_->Append(in_value.Build());
return *this;
}
diff --git a/extensions/common/value_builder.h b/extensions/common/value_builder.h
index 17020a8..d746904 100644
--- a/extensions/common/value_builder.h
+++ b/extensions/common/value_builder.h
@@ -52,10 +52,9 @@ class DictionaryBuilder {
explicit DictionaryBuilder(const base::DictionaryValue& init);
~DictionaryBuilder();
- // Workaround to allow you to pass rvalue ExtensionBuilders by reference to
- // other functions.
- // TODO(limasdf): Remove. Write move constructor instead.
- DictionaryBuilder& Pass() { return *this; }
+ // Move constructor and operator=.
+ DictionaryBuilder(DictionaryBuilder&& other);
+ DictionaryBuilder& operator=(DictionaryBuilder&& other);
// Can only be called once, after which it's invalid to use the builder.
scoped_ptr<base::DictionaryValue> Build() { return std::move(dict_); }
@@ -69,7 +68,7 @@ class DictionaryBuilder {
DictionaryBuilder& Set(const std::string& path, const std::string& in_value);
DictionaryBuilder& Set(const std::string& path,
const base::string16& in_value);
- DictionaryBuilder& Set(const std::string& path, DictionaryBuilder& in_value);
+ DictionaryBuilder& Set(const std::string& path, DictionaryBuilder in_value);
DictionaryBuilder& Set(const std::string& path, ListBuilder in_value);
DictionaryBuilder& Set(const std::string& path,
scoped_ptr<base::Value> in_value);
@@ -99,7 +98,7 @@ class ListBuilder {
ListBuilder& Append(double in_value);
ListBuilder& Append(const std::string& in_value);
ListBuilder& Append(const base::string16& in_value);
- ListBuilder& Append(DictionaryBuilder& in_value);
+ ListBuilder& Append(DictionaryBuilder in_value);
ListBuilder& Append(ListBuilder in_value);
// Named differently because overload resolution is too eager to
diff --git a/extensions/shell/browser/api/identity/identity_api_unittest.cc b/extensions/shell/browser/api/identity/identity_api_unittest.cc
index 1802fdb..bf9248c 100644
--- a/extensions/shell/browser/api/identity/identity_api_unittest.cc
+++ b/extensions/shell/browser/api/identity/identity_api_unittest.cc
@@ -65,19 +65,18 @@ class IdentityApiTest : public ApiUnitTest {
// Create an extension with OAuth2 scopes.
set_extension(
ExtensionBuilder()
- .SetManifest(
+ .SetManifest(std::move(
DictionaryBuilder()
.Set("name", "Test")
.Set("version", "1.0")
- .Set(
- "oauth2",
- DictionaryBuilder()
- .Set("client_id",
- "123456.apps.googleusercontent.com")
- .Set(
- "scopes",
- std::move(ListBuilder().Append(
- "https://www.googleapis.com/auth/drive")))))
+ .Set("oauth2",
+ std::move(DictionaryBuilder()
+ .Set("client_id",
+ "123456.apps.googleusercontent.com")
+ .Set("scopes",
+ std::move(ListBuilder().Append(
+ "https://www.googleapis.com/"
+ "auth/drive")))))))
.SetLocation(Manifest::UNPACKED)
.Build());
}
diff --git a/extensions/shell/browser/shell_native_app_window_aura_unittest.cc b/extensions/shell/browser/shell_native_app_window_aura_unittest.cc
index 5592f1d..728e787 100644
--- a/extensions/shell/browser/shell_native_app_window_aura_unittest.cc
+++ b/extensions/shell/browser/shell_native_app_window_aura_unittest.cc
@@ -44,10 +44,10 @@ TEST_F(ShellNativeAppWindowAuraTest, Bounds) {
new content::TestBrowserContext);
scoped_refptr<Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "test extension")
- .Set("version", "1")
- .Set("manifest_version", 2))
+ .SetManifest(std::move(DictionaryBuilder()
+ .Set("name", "test extension")
+ .Set("version", "1")
+ .Set("manifest_version", 2)))
.Build();
AppWindow* app_window = new AppWindow(