diff options
author | limasdf <limasdf@gmail.com> | 2015-12-19 04:04:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-19 12:06:04 +0000 |
commit | 21d67e679792a286c581f20ea8e4848b9c34061e (patch) | |
tree | dc6783b7a0229c79e3a8514293fc874eb0fa4789 | |
parent | 49f72db8dbff60fb22dfddf09dddeffe54f674db (diff) | |
download | chromium_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}
82 files changed, 1109 insertions, 1012 deletions
diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc index 01a1bbb..01e7c73 100644 --- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc @@ -848,9 +848,9 @@ TEST_F(ShortcutsProviderTest, Extension) { // Claim the extension has been unloaded. scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "Echo") - .Set("version", "1.0")) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "Echo") + .Set("version", "1.0"))) .SetID("cedabbhfglmiikkmdgcpjdkocfcmbkee") .Build(); extensions::UnloadedExtensionInfo details( diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc index 9efaba6..76d5587 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc @@ -464,48 +464,52 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTasks) { // Foo.app can handle "text/plain" and "text/html". extensions::ExtensionBuilder foo_app; - foo_app.SetManifest( + foo_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.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"))))) - .Set("file_handlers", - extensions::DictionaryBuilder().Set( - "text", - extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", std::move(extensions::ListBuilder() + "background.js"))))))) + .Set( + "file_handlers", + std::move(extensions::DictionaryBuilder().Set( + "text", + std::move(extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", + std::move(extensions::ListBuilder() .Append("text/plain") - .Append("text/html")))))); + .Append("text/html"))))))))); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar.app can only handle "text/plain". extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.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"))))) - .Set("file_handlers", - extensions::DictionaryBuilder().Set( - "text", - extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", std::move(extensions::ListBuilder().Append( - "text/plain")))))); + "background.js"))))))) + .Set( + "file_handlers", + std::move(extensions::DictionaryBuilder().Set( + "text", + std::move(extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", + std::move(extensions::ListBuilder().Append( + "text/plain"))))))))); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -567,7 +571,7 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) { // Foo.app can handle ".txt" and ".html". // This one is an extension, and has "file_browser_handlers" extensions::ExtensionBuilder foo_app; - foo_app.SetManifest( + foo_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") @@ -575,20 +579,20 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) { .Set("permissions", std::move(extensions::ListBuilder().Append( "fileBrowserHandler"))) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder() .Append("filesystem:*.txt") - .Append("filesystem:*.html"))))))); + .Append("filesystem:*.html"))))))))); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar.app can only handle ".txt". extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") @@ -596,13 +600,13 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) { .Set("permissions", std::move(extensions::ListBuilder().Append( "fileBrowserHandler"))) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder().Append( - "filesystem:*.txt"))))))); + "filesystem:*.txt"))))))))); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -651,31 +655,33 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks) { // Foo.app can handle "text/plain". // This is a packaged app (file handler). extensions::ExtensionBuilder foo_app; - foo_app.SetManifest( + foo_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.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"))))) - .Set("file_handlers", - extensions::DictionaryBuilder().Set( - "text", - extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", std::move(extensions::ListBuilder().Append( - "text/plain")))))); + "background.js"))))))) + .Set( + "file_handlers", + std::move(extensions::DictionaryBuilder().Set( + "text", + std::move(extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", + std::move(extensions::ListBuilder().Append( + "text/plain"))))))))); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar.app can only handle ".txt". // This is an extension (file browser handler). extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") @@ -683,13 +689,13 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks) { .Set("permissions", std::move(extensions::ListBuilder().Append( "fileBrowserHandler"))) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder().Append( - "filesystem:*.txt"))))))); + "filesystem:*.txt"))))))))); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -767,7 +773,7 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { // Bar.app can handle ".gdoc" files. // This is an extension (file browser handler). extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") @@ -775,13 +781,13 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { .Set("permissions", std::move(extensions::ListBuilder().Append( "fileBrowserHandler"))) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder().Append( - "filesystem:*.gdoc"))))))); + "filesystem:*.gdoc"))))))))); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -789,7 +795,7 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { // The ID "kFileManagerAppId" used here is precisely the one that identifies // the Chrome OS Files.app application. extensions::ExtensionBuilder files_app; - files_app.SetManifest( + files_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Files") .Set("version", "1.0.0") @@ -797,13 +803,13 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { .Set("permissions", std::move(extensions::ListBuilder().Append( "fileBrowserHandler"))) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder().Append( - "filesystem:*.gdoc"))))))); + "filesystem:*.gdoc"))))))))); files_app.SetID(kFileManagerAppId); extension_service_->AddExtension(files_app.Build().get()); @@ -838,99 +844,104 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTask_Generic) { // Foo app provides file handler for text/plain and all file types. extensions::ExtensionBuilder foo_app; - foo_app.SetManifest( + foo_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.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"))))))) .Set("file_handlers", - extensions::DictionaryBuilder() - .Set("any", - extensions::DictionaryBuilder().Set( - "types", - std::move(extensions::ListBuilder().Append("*/*")))) - .Set("text", - extensions::DictionaryBuilder().Set( - "types", std::move(extensions::ListBuilder().Append( - "text/plain")))))); + std::move( + extensions::DictionaryBuilder() + .Set("any", + std::move(extensions::DictionaryBuilder().Set( + "types", std::move(extensions::ListBuilder() + .Append("*/*"))))) + .Set("text", + std::move(extensions::DictionaryBuilder().Set( + "types", + std::move(extensions::ListBuilder().Append( + "text/plain"))))))))); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar app provides file handler for .txt and not provide generic file // handler. extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.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"))))))) .Set("file_handlers", - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "text", - extensions::DictionaryBuilder().Set( - "extensions", - std::move(extensions::ListBuilder().Append("txt")))))); + std::move(extensions::DictionaryBuilder().Set( + "extensions", std::move(extensions::ListBuilder().Append( + "txt"))))))))); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); // Baz app provides file handler for all extensions and images. extensions::ExtensionBuilder baz_app; - baz_app.SetManifest( + baz_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Baz") .Set("version", "1.0.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"))))) - .Set("file_handlers", - extensions::DictionaryBuilder() - .Set("any", - extensions::DictionaryBuilder().Set( - "extensions", std::move(extensions::ListBuilder() - .Append("*") - .Append("bar")))) - .Set("image", - extensions::DictionaryBuilder().Set( - "types", std::move(extensions::ListBuilder().Append( - "image/*")))))); + "background.js"))))))) + .Set( + "file_handlers", + std::move( + extensions::DictionaryBuilder() + .Set("any", + std::move(extensions::DictionaryBuilder().Set( + "extensions", std::move(extensions::ListBuilder() + .Append("*") + .Append("bar"))))) + .Set("image", + std::move(extensions::DictionaryBuilder().Set( + "types", + std::move(extensions::ListBuilder().Append( + "image/*"))))))))); baz_app.SetID(kBazId); extension_service_->AddExtension(baz_app.Build().get()); // Qux app provides file handler for all types. extensions::ExtensionBuilder qux_app; - qux_app.SetManifest( + qux_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Qux") .Set("version", "1.0.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"))))))) .Set("file_handlers", - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "any", - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "types", - std::move(extensions::ListBuilder().Append("*")))))); + std::move(extensions::ListBuilder().Append("*"))))))))); qux_app.SetID(kQuxId); extension_service_->AddExtension(qux_app.Build().get()); diff --git a/chrome/browser/chromeos/power/extension_event_observer_unittest.cc b/chrome/browser/chromeos/power/extension_event_observer_unittest.cc index 5858c5d..07592af 100644 --- a/chrome/browser/chromeos/power/extension_event_observer_unittest.cc +++ b/chrome/browser/chromeos/power/extension_event_observer_unittest.cc @@ -88,21 +88,21 @@ class ExtensionEventObserverTest : public ::testing::Test { bool uses_gcm) { scoped_refptr<extensions::Extension> app = extensions::ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", name) .Set("version", "1.0.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"))))))) .Set("permissions", std::move(extensions::ListBuilder().Append( - uses_gcm ? "gcm" : "")))) + uses_gcm ? "gcm" : ""))))) .Build(); created_apps_.push_back(app); diff --git a/chrome/browser/chromeos/power/renderer_freezer_unittest.cc b/chrome/browser/chromeos/power/renderer_freezer_unittest.cc index 0d937c1..1671511 100644 --- a/chrome/browser/chromeos/power/renderer_freezer_unittest.cc +++ b/chrome/browser/chromeos/power/renderer_freezer_unittest.cc @@ -311,20 +311,20 @@ TEST_F(RendererFreezerTestWithExtensions, DoesNotFreezeGcmExtensionRenderers) { // First build the GCM extension. scoped_refptr<extensions::Extension> gcm_app = extensions::ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "GCM App") .Set("version", "1.0.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"))))))) .Set("permissions", - std::move(extensions::ListBuilder().Append("gcm")))) + std::move(extensions::ListBuilder().Append("gcm"))))) .Build(); // Now install it and give it a renderer. @@ -344,18 +344,18 @@ TEST_F(RendererFreezerTestWithExtensions, FreezesNonGcmExtensionRenderers) { // First build the extension. scoped_refptr<extensions::Extension> background_app = extensions::ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Background App") .Set("version", "1.0.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"))))))))) .Build(); // Now install it and give it a renderer. diff --git a/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc b/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc index 792ad86..f1ba6c6 100644 --- a/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc +++ b/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc @@ -130,22 +130,22 @@ class PrinterDetectorAppSearchEnabledTest : public testing::Test { // Creates a test extension with the provided permissions. scoped_refptr<extensions::Extension> CreateTestExtension( ListBuilder permissions_builder, - DictionaryBuilder& usb_printers_builder) { + DictionaryBuilder usb_printers_builder) { return extensions::ExtensionBuilder() .SetID("fake_extension_id") - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", "Printer provider extension") .Set("manifest_version", 2) .Set("version", "1.0") // Needed to enable usb API. - .Set("app", DictionaryBuilder().Set( + .Set("app", std::move(DictionaryBuilder().Set( "background", - DictionaryBuilder().Set( - "scripts", - std::move(ListBuilder().Append("bg.js"))))) + std::move(DictionaryBuilder().Set( + "scripts", std::move(ListBuilder().Append( + "bg.js"))))))) .Set("permissions", std::move(permissions_builder)) - .Set("usb_printers", usb_printers_builder)) + .Set("usb_printers", std::move(usb_printers_builder)))) .Build(); } @@ -177,12 +177,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) { std::move(ListBuilder() .Append("usb") .Append("printerProvider") - .Append(DictionaryBuilder().Set( - "usbDevices", std::move(ListBuilder().Append( + .Append(std::move(DictionaryBuilder().Set( + "usbDevices", std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("vendorId", 123) - .Set("productId", 456)))))), - DictionaryBuilder().Set("filters", ListBuilder()).Pass()); + .Set("productId", 456)))))))), + std::move(DictionaryBuilder().Set("filters", ListBuilder()))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -200,12 +200,13 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) { TEST_F(PrinterDetectorAppSearchEnabledTest, UsbHandlerExists_NotPrinterProvider) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder().Append("usb").Append(DictionaryBuilder().Set( - "usbDevices", - std::move(ListBuilder().Append(DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 756)))))), - DictionaryBuilder().Set("filters", ListBuilder()).Pass()); + std::move( + ListBuilder().Append("usb").Append(std::move(DictionaryBuilder().Set( + "usbDevices", std::move(ListBuilder().Append( + std::move(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 756)))))))), + std::move(DictionaryBuilder().Set("filters", ListBuilder()))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -226,12 +227,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, std::move(ListBuilder() .Append("usb") .Append("printerProvider") - .Append(DictionaryBuilder().Set( - "usbDevices", std::move(ListBuilder().Append( + .Append(std::move(DictionaryBuilder().Set( + "usbDevices", std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("vendorId", 123) - .Set("productId", 001)))))), - DictionaryBuilder().Set("filters", ListBuilder()).Pass()); + .Set("productId", 001)))))))), + std::move(DictionaryBuilder().Set("filters", ListBuilder()))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -250,10 +251,11 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_NotFound) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( std::move(ListBuilder().Append("usb").Append("printerProvider")), - DictionaryBuilder().Set("filters", std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 001))))); + std::move(DictionaryBuilder().Set( + "filters", std::move(ListBuilder().Append( + std::move(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 001))))))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -272,10 +274,11 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_WithProductId) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( std::move(ListBuilder().Append("usb").Append("printerProvider")), - DictionaryBuilder().Set("filters", std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 456))))); + std::move(DictionaryBuilder().Set( + "filters", std::move(ListBuilder().Append( + std::move(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 456))))))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -294,11 +297,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_WithInterfaceClass) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( std::move(ListBuilder().Append("usb").Append("printerProvider")), - DictionaryBuilder().Set( - "filters", std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("interfaceClass", kPrinterInterfaceClass))))); + std::move(DictionaryBuilder().Set( + "filters", + std::move(ListBuilder().Append(std::move( + DictionaryBuilder() + .Set("vendorId", 123) + .Set("interfaceClass", kPrinterInterfaceClass))))))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -316,11 +320,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, IgnoreNonPrinters) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( std::move(ListBuilder().Append("usb").Append("printerProvider")), - DictionaryBuilder().Set( - "filters", std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("interfaceClass", kPrinterInterfaceClass))))); + std::move(DictionaryBuilder().Set( + "filters", + std::move(ListBuilder().Append(std::move( + DictionaryBuilder() + .Set("vendorId", 123) + .Set("interfaceClass", kPrinterInterfaceClass))))))); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); diff --git a/chrome/browser/extensions/active_script_controller_unittest.cc b/chrome/browser/extensions/active_script_controller_unittest.cc index 4c16930..6876c57 100644 --- a/chrome/browser/extensions/active_script_controller_unittest.cc +++ b/chrome/browser/extensions/active_script_controller_unittest.cc @@ -102,13 +102,14 @@ const Extension* ActiveScriptControllerUnitTest::AddExtension() { const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension"); extension_ = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "all_hosts_extension") - .Set("description", "an extension") - .Set("manifest_version", 2) - .Set("version", "1.0.0") - .Set("permissions", std::move(ListBuilder().Append( - kAllHostsPermission)))) + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "all_hosts_extension") + .Set("description", "an extension") + .Set("manifest_version", 2) + .Set("version", "1.0.0") + .Set("permissions", + std::move(ListBuilder().Append(kAllHostsPermission))))) .SetLocation(Manifest::INTERNAL) .SetID(kId) .Build(); diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index 45ae57c..53d270a 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc @@ -50,11 +50,11 @@ scoped_refptr<const Extension> CreateTestExtension( if (has_tab_capture_permission) permissions.Append("tabCapture"); return ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Extension with ID " + id) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", std::move(permissions))) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Extension with ID " + id) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", std::move(permissions)))) .SetID(id) .Build(); } diff --git a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc index 8c77afd..a66c2fd 100644 --- a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc @@ -149,10 +149,10 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .SetID(kExtensionID) .Build(); extension_service1->AddExtension(extension.get()); @@ -206,10 +206,10 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) { scoped_refptr<Extension> extension2 = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .SetID("fpofdchlamddhnajleknffcbmnjfahpg") .Build(); extension_service1->AddExtension(extension.get()); @@ -255,10 +255,10 @@ TEST_F(ActivityLogEnabledTest, AppAndCommandLine) { // Enable the extension. scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .SetID(kExtensionID) .Build(); extension_service->AddExtension(extension.get()); diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc index 72fa22c..be3473e 100644 --- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc @@ -232,10 +232,10 @@ TEST_F(ActivityLogTest, LogAndFetchActions) { TEST_F(ActivityLogTest, LogPrerender) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); ActivityLog* activity_log = ActivityLog::GetInstance(profile()); @@ -326,10 +326,10 @@ TEST_F(ActivityLogTest, ArgUrlExtraction) { now - base::TimeDelta::FromSeconds(3), Action::ACTION_API_CALL, "windows.create"); - action->set_args( - ListBuilder() - .Append(DictionaryBuilder().Set("url", "http://www.google.co.uk")) - .Build()); + action->set_args(ListBuilder() + .Append(std::move(DictionaryBuilder().Set( + "url", "http://www.google.co.uk"))) + .Build()); activity_log->LogAction(action); activity_log->GetFilteredActions( @@ -345,10 +345,10 @@ TEST_F(ActivityLogTest, ArgUrlExtraction) { TEST_F(ActivityLogTest, UninstalledExtension) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); ActivityLog* activity_log = ActivityLog::GetInstance(profile()); diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc index 51218db..d876c93 100644 --- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc @@ -535,10 +535,10 @@ TEST_F(CountingPolicyTest, Construct) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); scoped_ptr<base::ListValue> args(new base::ListValue()); @@ -556,10 +556,10 @@ TEST_F(CountingPolicyTest, LogWithStrippedArguments) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); @@ -702,10 +702,10 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc index 8f969b8..cea6b16 100644 --- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc @@ -453,10 +453,10 @@ TEST_F(FullStreamUIPolicyTest, Construct) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); scoped_ptr<base::ListValue> args(new base::ListValue()); @@ -474,10 +474,10 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); @@ -512,10 +512,10 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); @@ -610,10 +610,10 @@ TEST_F(FullStreamUIPolicyTest, LogWithArguments) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); @@ -951,10 +951,10 @@ TEST_F(FullStreamUIPolicyTest, DeleteDatabase) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); diff --git a/chrome/browser/extensions/api/debugger/debugger_apitest.cc b/chrome/browser/extensions/api/debugger/debugger_apitest.cc index ff1a67d..ff15fa0 100644 --- a/chrome/browser/extensions/api/debugger/debugger_apitest.cc +++ b/chrome/browser/extensions/api/debugger/debugger_apitest.cc @@ -65,15 +65,15 @@ void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) { void DebuggerApiTest::SetUpOnMainThread() { ExtensionApiTest::SetUpOnMainThread(); - extension_ = - ExtensionBuilder() - .SetManifest(DictionaryBuilder() + extension_ = ExtensionBuilder() + .SetManifest(std::move( + DictionaryBuilder() .Set("name", "debugger") .Set("version", "0.1") .Set("manifest_version", 2) .Set("permissions", - std::move(ListBuilder().Append("debugger")))) - .Build(); + std::move(ListBuilder().Append("debugger"))))) + .Build(); } testing::AssertionResult DebuggerApiTest::RunAttachFunction( diff --git a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc index a83cd75..ccb1e49 100644 --- a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc +++ b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc @@ -165,9 +165,10 @@ TEST(DeclarativeContentActionTest, SetIcon) { base::Base64Encode(binary_data, &data64); scoped_ptr<base::DictionaryValue> dict = - DictionaryBuilder().Set("instanceType", "declarativeContent.SetIcon") - .Set("imageData", - DictionaryBuilder().Set("19", data64)).Build(); + DictionaryBuilder() + .Set("instanceType", "declarativeContent.SetIcon") + .Set("imageData", std::move(DictionaryBuilder().Set("19", data64))) + .Build(); const Extension* extension = env.MakeExtension( *ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }")); diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc index 1c36c62..72aaf17 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc @@ -38,11 +38,11 @@ scoped_refptr<Extension> CreateExtensionWithBookmarksPermission( if (include_bookmarks) permissions.Append("bookmarks"); return ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", std::move(permissions))) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", std::move(permissions)))) .Build(); } diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc index 60b3468..407d973 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc @@ -150,10 +150,11 @@ const Extension* DeveloperPrivateApiUnitTest::LoadSimpleExtension() { .Set("manifest_version", 2) .Set("description", "an extension"); scoped_refptr<const Extension> extension = - ExtensionBuilder().SetManifest(manifest) - .SetLocation(Manifest::INTERNAL) - .SetID(id) - .Build(); + ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetLocation(Manifest::INTERNAL) + .SetID(id) + .Build(); service()->AddExtension(extension.get()); return extension.get(); } @@ -514,9 +515,9 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { api::developer_private::ERROR_TYPE_MANIFEST); scoped_ptr<base::ListValue> args = ListBuilder() - .Append(DictionaryBuilder() - .Set("extensionId", extension->id()) - .Set("type", type_string)) + .Append(std::move(DictionaryBuilder() + .Set("extensionId", extension->id()) + .Set("type", type_string))) .Build(); scoped_refptr<UIThreadExtensionFunction> function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); @@ -528,12 +529,13 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { // Next remove errors by id. int error_id = error_list[0]->id(); - args = ListBuilder() - .Append(DictionaryBuilder() - .Set("extensionId", extension->id()) - .Set("errorIds", - std::move(ListBuilder().Append(error_id)))) - .Build(); + args = + ListBuilder() + .Append(std::move( + DictionaryBuilder() + .Set("extensionId", extension->id()) + .Set("errorIds", std::move(ListBuilder().Append(error_id))))) + .Build(); function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); // And then there was one. @@ -541,7 +543,8 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { // Finally remove all errors for the extension. args = ListBuilder() - .Append(DictionaryBuilder().Set("extensionId", extension->id())) + .Append(std::move( + DictionaryBuilder().Set("extensionId", extension->id()))) .Build(); function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc index 6d38e51..fcbb23f 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc @@ -86,12 +86,13 @@ class ExtensionInfoGeneratorUnitTest : public ExtensionServiceTestBase { const std::string kId = crx_file::id_util::GenerateId(name); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", name) - .Set("description", "an extension") - .Set("manifest_version", 2) - .Set("version", "1.0.0") - .Set("permissions", std::move(permissions))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", name) + .Set("description", "an extension") + .Set("manifest_version", 2) + .Set("version", "1.0.0") + .Set("permissions", std::move(permissions)))) .SetLocation(Manifest::INTERNAL) .SetID(kId) .Build(); diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index 1475a57..c19c0f3 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -1657,14 +1657,16 @@ class GetAuthTokenFunctionPublicSessionTest : public GetAuthTokenFunctionTest { scoped_refptr<Extension> CreateTestExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Test") - .Set("version", "1.0") - .Set("oauth2", - DictionaryBuilder() - .Set("client_id", "clientId") - .Set("scopes", std::move(ListBuilder().Append( - "scope1"))))) + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "Test") + .Set("version", "1.0") + .Set("oauth2", + std::move( + DictionaryBuilder() + .Set("client_id", "clientId") + .Set("scopes", + std::move(ListBuilder().Append("scope1"))))))) .SetLocation(Manifest::UNPACKED) .SetID(id) .Build(); diff --git a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc index 51006e0..2a826d2 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc @@ -46,20 +46,21 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append( + .Append(std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("content", "content") .Set("description", "description") .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 1) - .Set("length", 4)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 6) - .Set("length", 3))))))) + std::move( + ListBuilder() + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 1) + .Set("length", 4))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 6) + .Set("length", 3))))))))) .Build(); ACMatchClassifications styles_expected; @@ -80,20 +81,21 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) { scoped_ptr<base::ListValue> swap_list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append( + .Append(std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("content", "content") .Set("description", "description") .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 6) - .Set("length", 3)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 1) - .Set("length", 4))))))) + std::move( + ListBuilder() + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 6) + .Set("length", 3))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 1) + .Set("length", 4))))))))) .Build(); scoped_ptr<SendSuggestions::Params> swapped_params( @@ -115,32 +117,33 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append( + .Append(std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("content", "content") .Set("description", "description") .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 9) - .Set("length", 2)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 9) - .Set("length", 2)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 4)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 1) - .Set("length", 2))))))) + std::move( + ListBuilder() + .Append(std::move(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 9) + .Set("length", 2))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 9) + .Set("length", 2))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 4))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 1) + .Set("length", 2))))))))) .Build(); ACMatchClassifications styles_expected; @@ -163,32 +166,33 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) { scoped_ptr<base::ListValue> moved_list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append( + .Append(std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("content", "content") .Set("description", "description") .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 4)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 9) - .Set("length", 2)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 9) - .Set("length", 2)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 1) - .Set("length", 2))))))) + std::move( + ListBuilder() + .Append(std::move(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 4))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 9) + .Set("length", 2))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 9) + .Set("length", 2))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 1) + .Set("length", 2))))))))) .Build(); scoped_ptr<SendSuggestions::Params> moved_params( @@ -210,32 +214,33 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append( + .Append(std::move(ListBuilder().Append(std::move( DictionaryBuilder() .Set("content", "content") .Set("description", "description") .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 3)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 2) - .Set("length", 3)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 0) - .Set("length", 3))))))) + std::move( + ListBuilder() + .Append(std::move(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 3))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 2) + .Set("length", 3))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 0) + .Set("length", 3))))))))) .Build(); ACMatchClassifications styles_expected; @@ -261,30 +266,34 @@ TEST(ExtensionOmniboxTest, DefaultSuggestResult) { // Default suggestions should not have a content parameter. scoped_ptr<base::ListValue> list = ListBuilder() - .Append(DictionaryBuilder() - .Set("description", "description") - .Set("descriptionStyles", - std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 5)) - .Append(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 3)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 2) - .Set("length", 3)) - .Append(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 0) - .Set("length", 3))))) + .Append(std::move( + DictionaryBuilder() + .Set("description", "description") + .Set( + "descriptionStyles", + std::move( + ListBuilder() + .Append(std::move( + DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 5))) + .Append(std::move(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 3))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 2) + .Set("length", 3))) + .Append(std::move(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 0) + .Set("length", 3))))))) .Build(); scoped_ptr<SetDefaultSuggestion::Params> params( diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc index 1fd4550..f5b25e2 100644 --- a/chrome/browser/extensions/api/storage/settings_apitest.cc +++ b/chrome/browser/extensions/api/storage/settings_apitest.cc @@ -503,15 +503,17 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) { std::move( extensions::ListBuilder().Append("one").Append("two").Append( "three"))) - .Set("dict-policy", - extensions::DictionaryBuilder().Set( - "list", - std::move(extensions::ListBuilder() - .Append(extensions::DictionaryBuilder() - .Set("one", 1) - .Set("two", 2)) - .Append(extensions::DictionaryBuilder().Set( - "three", 3))))) + .Set( + "dict-policy", + std::move(extensions::DictionaryBuilder().Set( + "list", + std::move( + extensions::ListBuilder() + .Append(std::move( + extensions::DictionaryBuilder().Set("one", 1).Set( + "two", 2))) + .Append(std::move(extensions::DictionaryBuilder().Set( + "three", 3))))))) .Build(); SetPolicies(*policy); // Now run the extension. diff --git a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc index 77c9667..5ca9a66 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc @@ -31,12 +31,13 @@ TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetID(extension_misc::kQuickOfficeExtensionId) - .SetManifest(DictionaryBuilder() - .Set("name", "MIME type handler test") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("mime_types", - std::move(ListBuilder().Append("text/plain")))) + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "MIME type handler test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("mime_types", + std::move(ListBuilder().Append("text/plain"))))) .Build(); ASSERT_TRUE(extension.get()); @@ -51,12 +52,13 @@ TEST_F(StreamsPrivateManifestTest, MimeTypesHandlerMIMETypesNotWhitelisted) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "MIME types test") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("mime_types", - std::move(ListBuilder().Append("text/plain")))) + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "MIME types test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("mime_types", + std::move(ListBuilder().Append("text/plain"))))) .Build(); ASSERT_TRUE(extension.get()); diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index debbdf50..d6d76f6 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc @@ -399,14 +399,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) { "/extensions/api_test/webrequest_hosted_app/index.html")); scoped_refptr<extensions::Extension> hosted_app = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "Some hosted app") - .Set("version", "1") - .Set("manifest_version", 2) - .Set("app", extensions::DictionaryBuilder() - .Set("launch", extensions::DictionaryBuilder() - .Set("web_url", hosted_app_url.spec())))) - .Build(); + .SetManifest(std::move( + extensions::DictionaryBuilder() + .Set("name", "Some hosted app") + .Set("version", "1") + .Set("manifest_version", 2) + .Set("app", std::move(extensions::DictionaryBuilder().Set( + "launch", + std::move(extensions::DictionaryBuilder().Set( + "web_url", hosted_app_url.spec()))))))) + .Build(); extensions::ExtensionSystem::Get(browser()->profile())->extension_service() ->AddExtension(hosted_app.get()); diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc index ba7d4a9..c6713c7 100644 --- a/chrome/browser/extensions/app_data_migrator_unittest.cc +++ b/chrome/browser/extensions/app_data_migrator_unittest.cc @@ -73,32 +73,34 @@ class AppDataMigratorTest : public testing::Test { scoped_refptr<const Extension> GetTestExtension(bool platform_app) { scoped_refptr<const Extension> app; if (platform_app) { - app = ExtensionBuilder() - .SetManifest( - DictionaryBuilder() - .Set("name", "test app") - .Set("version", "1") - .Set("app", - DictionaryBuilder().Set( - "background", - DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))) - .Set("permissions", - std::move(ListBuilder().Append("unlimitedStorage")))) - .Build(); + app = + ExtensionBuilder() + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "test app") + .Set("version", "1") + .Set("app", + std::move(DictionaryBuilder().Set( + "background", + std::move(DictionaryBuilder().Set( + "scripts", std::move(ListBuilder().Append( + "background.js"))))))) + .Set("permissions", + std::move(ListBuilder().Append("unlimitedStorage"))))) + .Build(); } else { app = ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", "test app") .Set("version", "1") - .Set("app", DictionaryBuilder().Set( - "launch", DictionaryBuilder().Set( - "local_path", "index.html"))) + .Set("app", + std::move(DictionaryBuilder().Set( + "launch", std::move(DictionaryBuilder().Set( + "local_path", "index.html"))))) .Set("permissions", - std::move(ListBuilder().Append("unlimitedStorage")))) + std::move(ListBuilder().Append("unlimitedStorage"))))) .Build(); } return app; diff --git a/chrome/browser/extensions/extension_action_manager_unittest.cc b/chrome/browser/extensions/extension_action_manager_unittest.cc index 76c47f1..617c41c 100644 --- a/chrome/browser/extensions/extension_action_manager_unittest.cc +++ b/chrome/browser/extensions/extension_action_manager_unittest.cc @@ -30,8 +30,8 @@ class ExtensionActionManagerTest : public testing::Test { protected: // Build an extension, populating |action_type| key with |action|, and // "icons" key with |extension_icons|. - scoped_refptr<Extension> BuildExtension(DictionaryBuilder& extension_icons, - DictionaryBuilder& action, + scoped_refptr<Extension> BuildExtension(DictionaryBuilder extension_icons, + DictionaryBuilder action, const char* action_type); // Returns true if |action|'s title matches |extension|'s name. @@ -71,19 +71,19 @@ ExtensionActionManagerTest::ExtensionActionManagerTest() } scoped_refptr<Extension> ExtensionActionManagerTest::BuildExtension( - DictionaryBuilder& extension_icons, - DictionaryBuilder& action, + DictionaryBuilder extension_icons, + DictionaryBuilder action, const char* action_type) { std::string id = base::IntToString(curr_id_++); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("version", "1") .Set("manifest_version", 2) - .Set("icons", extension_icons) - .Set(action_type, action) - .Set("name", std::string("Test Extension").append(id))) + .Set("icons", std::move(extension_icons)) + .Set(action_type, std::move(action)) + .Set("name", std::string("Test Extension").append(id)))) .SetLocation(Manifest::UNPACKED) .SetID(id) .Build(); @@ -119,11 +119,11 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that the largest icon from the extension's "icons" key is chosen as a // replacement for missing action default_icons keys. "19" should not be // replaced because "38" can always be used in its place. - scoped_refptr<Extension> extension = BuildExtension( - DictionaryBuilder().Set("48", "icon48.png") - .Set("128", "icon128.png"), - DictionaryBuilder().Pass(), - action_type); + scoped_refptr<Extension> extension = + BuildExtension(std::move(DictionaryBuilder() + .Set("48", "icon48.png") + .Set("128", "icon128.png")), + DictionaryBuilder(), action_type); ASSERT_TRUE(extension.get()); const ExtensionAction* action = GetAction(action_type, *extension.get()); @@ -134,10 +134,9 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that the action's missing default_icons are not replaced with smaller // icons. - extension = BuildExtension( - DictionaryBuilder().Set("24", "icon24.png"), - DictionaryBuilder().Pass(), - action_type); + extension = + BuildExtension(std::move(DictionaryBuilder().Set("24", "icon24.png")), + DictionaryBuilder(), action_type); ASSERT_TRUE(extension.get()); action = GetAction(action_type, *extension.get()); @@ -149,9 +148,10 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that an action's 19px icon is not replaced if a 38px action icon // exists. extension = BuildExtension( - DictionaryBuilder().Set("128", "icon128.png"), - DictionaryBuilder().Set("default_icon", DictionaryBuilder() - .Set("38", "action38.png")), + std::move(DictionaryBuilder().Set("128", "icon128.png")), + std::move(DictionaryBuilder().Set( + "default_icon", + std::move(DictionaryBuilder().Set("38", "action38.png")))), action_type); ASSERT_TRUE(extension.get()); @@ -162,11 +162,13 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that existing default_icons and default_title are not replaced. extension = BuildExtension( - DictionaryBuilder().Set("128", "icon128.png"), - DictionaryBuilder().Set("default_title", "Action!") - .Set("default_icon", DictionaryBuilder() - .Set("19", "action19.png") - .Set("38", "action38.png")), + std::move(DictionaryBuilder().Set("128", "icon128.png")), + std::move( + DictionaryBuilder() + .Set("default_title", "Action!") + .Set("default_icon", std::move(DictionaryBuilder() + .Set("19", "action19.png") + .Set("38", "action38.png")))), action_type); ASSERT_TRUE(extension.get()); @@ -191,10 +193,11 @@ TEST_F(ExtensionActionManagerTest, PopulatePageAction) { TEST_F(ExtensionActionManagerTest, GetBestFitActionTest) { // Create an extension with page action defaults. scoped_refptr<Extension> extension = BuildExtension( - DictionaryBuilder().Set("48", "icon48.png"), - DictionaryBuilder().Set("default_title", "Action!") - .Set("default_icon", DictionaryBuilder() - .Set("38", "action38.png")), + std::move(DictionaryBuilder().Set("48", "icon48.png")), + std::move(DictionaryBuilder() + .Set("default_title", "Action!") + .Set("default_icon", std::move(DictionaryBuilder().Set( + "38", "action38.png")))), kPageAction); ASSERT_TRUE(extension.get()); @@ -210,10 +213,9 @@ TEST_F(ExtensionActionManagerTest, GetBestFitActionTest) { "action38.png"); // Create a new extension without page action defaults. - extension = BuildExtension( - DictionaryBuilder().Set("48", "icon48.png"), - DictionaryBuilder().Pass(), - kPageAction); + extension = + BuildExtension(std::move(DictionaryBuilder().Set("48", "icon48.png")), + DictionaryBuilder(), kPageAction); ASSERT_TRUE(extension.get()); action = diff --git a/chrome/browser/extensions/extension_action_test_util.cc b/chrome/browser/extensions/extension_action_test_util.cc index 1a9de97..b860331 100644 --- a/chrome/browser/extensions/extension_action_test_util.cc +++ b/chrome/browser/extensions/extension_action_test_util.cc @@ -150,12 +150,13 @@ scoped_refptr<const Extension> CreateActionExtension( } if (action_key) - manifest.Set(action_key, DictionaryBuilder().Pass()); + manifest.Set(action_key, DictionaryBuilder()); - return ExtensionBuilder().SetManifest(manifest.Pass()). - SetID(crx_file::id_util::GenerateId(name)). - SetLocation(location). - Build(); + return ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetID(crx_file::id_util::GenerateId(name)) + .SetLocation(location) + .Build(); } ToolbarActionsModel* CreateToolbarModelForProfile(Profile* profile) { diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc index 8f25568..1d979aa 100644 --- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc +++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc @@ -159,13 +159,13 @@ const Extension* ExtensionContextMenuModelTest::AddExtensionWithHostPermission( manifest.Set("name", name) .Set("version", "1") .Set("manifest_version", 2) - .Set(action_key, DictionaryBuilder().Pass()); + .Set(action_key, DictionaryBuilder()); if (!host_permission.empty()) manifest.Set("permissions", std::move(ListBuilder().Append(host_permission))); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(manifest.Pass()) + .SetManifest(std::move(manifest)) .SetID(crx_file::id_util::GenerateId(name)) .SetLocation(location) .Build(); @@ -229,11 +229,12 @@ TEST_F(ExtensionContextMenuModelTest, ComponentExtensionContextMenu) { std::string name("component"); scoped_ptr<base::DictionaryValue> manifest = - DictionaryBuilder().Set("name", name) - .Set("version", "1") - .Set("manifest_version", 2) - .Set("browser_action", DictionaryBuilder().Pass()) - .Build(); + DictionaryBuilder() + .Set("name", name) + .Set("version", "1") + .Set("manifest_version", 2) + .Set("browser_action", DictionaryBuilder()) + .Build(); { scoped_refptr<const Extension> extension = diff --git a/chrome/browser/extensions/extension_install_prompt_browsertest.cc b/chrome/browser/extensions/extension_install_prompt_browsertest.cc index da055ca..75051ee 100644 --- a/chrome/browser/extensions/extension_install_prompt_browsertest.cc +++ b/chrome/browser/extensions/extension_install_prompt_browsertest.cc @@ -19,9 +19,9 @@ namespace { scoped_refptr<extensions::Extension> BuildTestExtension() { return extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0")) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0"))) .Build(); } diff --git a/chrome/browser/extensions/extension_install_prompt_unittest.cc b/chrome/browser/extensions/extension_install_prompt_unittest.cc index 6911666..313376b 100644 --- a/chrome/browser/extensions/extension_install_prompt_unittest.cc +++ b/chrome/browser/extensions/extension_install_prompt_unittest.cc @@ -75,11 +75,13 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsPermissionWarnings) { new PermissionSet(api_permissions, ManifestPermissionSet(), URLPatternSet(), URLPatternSet())); scoped_refptr<const Extension> extension = - ExtensionBuilder().SetManifest( - DictionaryBuilder().Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Random Ext")).Build(); + ExtensionBuilder() + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Random Ext"))) + .Build(); content::TestWebContentsFactory factory; ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); @@ -103,16 +105,17 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Random Ext") - .Set("permissions", - std::move(ListBuilder() - .Append("http://*/*") - .Append("http://www.google.com/") - .Append("tabs")))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Random Ext") + .Set("permissions", + std::move(ListBuilder() + .Append("http://*/*") + .Append("http://www.google.com/") + .Append("tabs"))))) .Build(); content::TestWebContentsFactory factory; @@ -133,15 +136,16 @@ TEST_F(ExtensionInstallPromptUnitTest, DelegatedPromptShowsOptionalPermissions) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Random Ext") - .Set("permissions", std::move(ListBuilder().Append( - "clipboardRead"))) - .Set("optional_permissions", - std::move(ListBuilder().Append("tabs")))) + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Random Ext") + .Set("permissions", + std::move(ListBuilder().Append("clipboardRead"))) + .Set("optional_permissions", + std::move(ListBuilder().Append("tabs"))))) .Build(); content::TestWebContentsFactory factory; diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc index 54b732e..b4e3f34 100644 --- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc @@ -139,10 +139,11 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2)); + builder.SetManifest( + std::move(DictionaryBuilder() + .Set("name", std::string("Extension " + index)) + .Set("version", "1.0") + .Set("manifest_version", 2))); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -157,13 +158,13 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("browser_action", - DictionaryBuilder().Set( - "default_title", "Default title"))); + builder.SetManifest(std::move( + DictionaryBuilder() + .Set("name", std::string("Extension " + index)) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("browser_action", std::move(DictionaryBuilder().Set( + "default_title", "Default title"))))); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -178,13 +179,14 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("chrome_settings_overrides", - DictionaryBuilder().Set( - "homepage", "http://www.google.com"))); + builder.SetManifest( + std::move(DictionaryBuilder() + .Set("name", std::string("Extension " + index)) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("chrome_settings_overrides", + std::move(DictionaryBuilder().Set( + "homepage", "http://www.google.com"))))); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -199,15 +201,15 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest( + builder.SetManifest(std::move( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) .Set("chrome_settings_overrides", - DictionaryBuilder().Set("startup_pages", - std::move(ListBuilder().Append( - "http://www.google.com"))))); + std::move(DictionaryBuilder().Set( + "startup_pages", std::move(ListBuilder().Append( + "http://www.google.com"))))))); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -222,13 +224,13 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("chrome_url_overrides", - DictionaryBuilder().Set( - "newtab", "Default.html"))); + builder.SetManifest(std::move( + DictionaryBuilder() + .Set("name", std::string("Extension " + index)) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("chrome_url_overrides", std::move(DictionaryBuilder().Set( + "newtab", "Default.html"))))); builder.SetLocation(location); builder.SetID(id); @@ -244,12 +246,12 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest( + builder.SetManifest(std::move( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("permissions", std::move(ListBuilder().Append("proxy")))); + .Set("permissions", std::move(ListBuilder().Append("proxy"))))); builder.SetLocation(location); builder.SetID(id); diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index 54c44fe..0482137 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc @@ -475,10 +475,10 @@ IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, NotInstalled) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") - .SetManifest(DictionaryBuilder() - .Set("name", "Fake extension") - .Set("version", "1") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Fake extension") + .Set("version", "1") + .Set("manifest_version", 2))) .Build(); ui_test_utils::NavigateToURL(browser(), chromium_org_url()); @@ -1191,10 +1191,10 @@ IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, ExtensionBuilder() // A bit scary that this works... .SetID("invalid") - .SetManifest(DictionaryBuilder() - .Set("name", "Fake extension") - .Set("version", "1") - .Set("manifest_version", 2)) + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "Fake extension") + .Set("version", "1") + .Set("manifest_version", 2))) .Build(); ui_test_utils::NavigateToURL(browser(), chromium_org_url()); diff --git a/chrome/browser/extensions/extension_migrator_unittest.cc b/chrome/browser/extensions/extension_migrator_unittest.cc index 7e2ba31..cad4349 100644 --- a/chrome/browser/extensions/extension_migrator_unittest.cc +++ b/chrome/browser/extensions/extension_migrator_unittest.cc @@ -24,8 +24,8 @@ const char kNewId[] = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"; 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(); } diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 501976d..5c3ffb9 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -923,9 +923,9 @@ class ExtensionPrefsComponentExtension : public ExtensionPrefsTest { // Adding a component extension. component_extension_ = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set(manifest_keys::kName, "a") - .Set(manifest_keys::kVersion, "0.1")) + .SetManifest(std::move(DictionaryBuilder() + .Set(manifest_keys::kName, "a") + .Set(manifest_keys::kVersion, "0.1"))) .SetLocation(Manifest::COMPONENT) .SetPath(prefs_.extensions_dir().AppendASCII("a")) .Build(); @@ -934,9 +934,9 @@ class ExtensionPrefsComponentExtension : public ExtensionPrefsTest { // Adding a non component extension. no_component_extension_ = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set(manifest_keys::kName, "b") - .Set(manifest_keys::kVersion, "0.1")) + .SetManifest(std::move(DictionaryBuilder() + .Set(manifest_keys::kName, "b") + .Set(manifest_keys::kVersion, "0.1"))) .SetLocation(Manifest::INTERNAL) .SetPath(prefs_.extensions_dir().AppendASCII("b")) .Build(); diff --git a/chrome/browser/extensions/extension_reenabler_unittest.cc b/chrome/browser/extensions/extension_reenabler_unittest.cc index 43d05b6..3efa569 100644 --- a/chrome/browser/extensions/extension_reenabler_unittest.cc +++ b/chrome/browser/extensions/extension_reenabler_unittest.cc @@ -134,13 +134,14 @@ void ExtensionReenablerUnitTest::TearDown() { TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) { // Create a simple extension and add it to the service. scoped_refptr<const Extension> extension = - ExtensionBuilder(). - SetManifest(DictionaryBuilder().Set("name", "test ext"). - Set("version", "1.0"). - Set("manifest_version", 2). - Set("description", "a test ext")). - SetID(crx_file::id_util::GenerateId("test ext")). - Build(); + ExtensionBuilder() + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "test ext") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "a test ext"))) + .SetID(crx_file::id_util::GenerateId("test ext")) + .Build(); service()->AddExtension(extension.get()); EXPECT_TRUE(registry()->enabled_extensions().Contains(extension->id())); diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc index d9da886..ef959e8 100644 --- a/chrome/browser/extensions/extension_service_sync_unittest.cc +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc @@ -1836,14 +1836,14 @@ TEST_F(ExtensionServiceSyncTest, SyncExtensionHasAllhostsWithheld) { scoped_refptr<const Extension> extension = extensions::ExtensionBuilder() .SetLocation(Manifest::INTERNAL) - .SetManifest( + .SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", kName) .Set("description", "foo") .Set("manifest_version", 2) .Set("version", "1.0") .Set("permissions", - std::move(extensions::ListBuilder().Append("*://*/*")))) + std::move(extensions::ListBuilder().Append("*://*/*"))))) .SetID(crx_file::id_util::GenerateId(kName)) .Build(); diff --git a/chrome/browser/extensions/extension_web_ui_unittest.cc b/chrome/browser/extensions/extension_web_ui_unittest.cc index eada95f..cd57757 100644 --- a/chrome/browser/extensions/extension_web_ui_unittest.cc +++ b/chrome/browser/extensions/extension_web_ui_unittest.cc @@ -62,10 +62,10 @@ TEST_F(ExtensionWebUITest, ExtensionURLOverride) { manifest.Set(manifest_keys::kName, "ext1") .Set(manifest_keys::kVersion, "0.1") .Set(std::string(manifest_keys::kChromeURLOverrides), - DictionaryBuilder().Set("bookmarks", "1.html")); + std::move(DictionaryBuilder().Set("bookmarks", "1.html"))); scoped_refptr<Extension> ext_unpacked( ExtensionBuilder() - .SetManifest(manifest) + .SetManifest(std::move(manifest)) .SetLocation(Manifest::UNPACKED) .SetID("abcdefghijabcdefghijabcdefghijaa") .Build()); @@ -82,10 +82,10 @@ TEST_F(ExtensionWebUITest, ExtensionURLOverride) { manifest2.Set(manifest_keys::kName, "ext2") .Set(manifest_keys::kVersion, "0.1") .Set(std::string(manifest_keys::kChromeURLOverrides), - DictionaryBuilder().Set("bookmarks", "2.html")); + std::move(DictionaryBuilder().Set("bookmarks", "2.html"))); scoped_refptr<Extension> ext_component( ExtensionBuilder() - .SetManifest(manifest2) + .SetManifest(std::move(manifest2)) .SetLocation(Manifest::COMPONENT) .SetID("bbabcdefghijabcdefghijabcdefghij") .Build()); diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc index e89db7b..d916c89 100644 --- a/chrome/browser/extensions/location_bar_controller_unittest.cc +++ b/chrome/browser/extensions/location_bar_controller_unittest.cc @@ -74,13 +74,14 @@ class LocationBarControllerUnitTest : public ChromeRenderViewHostTestHarness { .Set("manifest_version", 2) .Set("permissions", std::move(ListBuilder().Append("tabs"))); if (has_page_actions) { - manifest.Set("page_action", DictionaryBuilder() - .Set("default_title", "Hello")); + manifest.Set("page_action", std::move(DictionaryBuilder().Set( + "default_title", "Hello"))); } scoped_refptr<const Extension> extension = - ExtensionBuilder().SetManifest(manifest.Pass()) - .SetID(crx_file::id_util::GenerateId(name)) - .Build(); + ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetID(crx_file::id_util::GenerateId(name)) + .Build(); extension_service_->AddExtension(extension.get()); return extension.get(); } diff --git a/chrome/browser/extensions/options_page_apitest.cc b/chrome/browser/extensions/options_page_apitest.cc index 2b4d466..b3ad332 100644 --- a/chrome/browser/extensions/options_page_apitest.cc +++ b/chrome/browser/extensions/options_page_apitest.cc @@ -75,7 +75,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DictionaryBuilder() .Set("manifest_version", 2) .Set("name", "Extension for options param test") - .Set("options_ui", DictionaryBuilder().Set("page", "options.html")) + .Set("options_ui", + std::move(DictionaryBuilder().Set("page", "options.html"))) .Set("version", "1") .ToJSON()); diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 1de34014..6d8a895 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -41,14 +41,14 @@ scoped_refptr<const Extension> CreateExtensionWithOptionalPermissions( const std::string& name) { return ExtensionBuilder() .SetLocation(Manifest::INTERNAL) - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", name) .Set("description", "foo") .Set("manifest_version", 2) .Set("version", "0.1.2.3") .Set("permissions", permissions.Pass()) - .Set("optional_permissions", optional_permissions.Pass())) + .Set("optional_permissions", std::move(optional_permissions)))) .SetID(crx_file::id_util::GenerateId(name)) .Build(); } diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc index ea8626c..6964abd 100644 --- a/chrome/browser/extensions/process_manager_browsertest.cc +++ b/chrome/browser/extensions/process_manager_browsertest.cc @@ -103,12 +103,13 @@ class ProcessManagerBrowserTest : public ExtensionBrowserTest { .Set("content_security_policy", "script-src 'self' 'unsafe-eval'; object-src 'self'") .Set("sandbox", - DictionaryBuilder().Set( - "pages", std::move(ListBuilder().Append("sandboxed.html")))) + std::move(DictionaryBuilder().Set( + "pages", std::move(ListBuilder().Append("sandboxed.html"))))) .Set("web_accessible_resources", std::move(ListBuilder().Append("*"))); if (has_background_process) { - manifest.Set("background", DictionaryBuilder().Set("page", "bg.html")); + manifest.Set("background", + std::move(DictionaryBuilder().Set("page", "bg.html"))); dir->WriteFile(FILE_PATH_LITERAL("bg.html"), "<iframe id='bgframe' src='empty.html'></iframe>"); } diff --git a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc index 6b37a5d..e1e8e64 100644 --- a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc +++ b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc @@ -47,14 +47,15 @@ scoped_refptr<const Extension> CreateExtensionWithPermissions( return ExtensionBuilder() .SetLocation(location) - .SetManifest(DictionaryBuilder() - .Set("name", name) - .Set("description", "foo") - .Set("manifest_version", 2) - .Set("version", "0.1.2.3") - .Set("content_scripts", - std::move(ListBuilder().Append(script.Pass()))) - .Set("permissions", std::move(explicit_host_list))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", name) + .Set("description", "foo") + .Set("manifest_version", 2) + .Set("version", "0.1.2.3") + .Set("content_scripts", + std::move(ListBuilder().Append(std::move(script)))) + .Set("permissions", std::move(explicit_host_list)))) .SetID(crx_file::id_util::GenerateId(name)) .Build(); } diff --git a/chrome/browser/extensions/shared_module_service_unittest.cc b/chrome/browser/extensions/shared_module_service_unittest.cc index 0f1d1e3..fb1d7a2c 100644 --- a/chrome/browser/extensions/shared_module_service_unittest.cc +++ b/chrome/browser/extensions/shared_module_service_unittest.cc @@ -38,8 +38,8 @@ scoped_refptr<Extension> CreateExtensionImportingModule( .Set("version", version) .Set("manifest_version", 2); if (!import_id.empty()) { - builder.Set("import", std::move(ListBuilder().Append( - DictionaryBuilder().Set("id", import_id)))); + builder.Set("import", std::move(ListBuilder().Append(std::move( + DictionaryBuilder().Set("id", import_id))))); } scoped_ptr<base::DictionaryValue> manifest = builder.Build(); @@ -130,8 +130,8 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUninstall) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js")))) + std::move(DictionaryBuilder().Set( + "resources", std::move(ListBuilder().Append("foo.js"))))) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder() @@ -171,8 +171,8 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js")))) + std::move(DictionaryBuilder().Set( + "resources", std::move(ListBuilder().Append("foo.js"))))) .Build(); scoped_refptr<Extension> shared_module_1 = ExtensionBuilder() @@ -188,8 +188,8 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js")))) + std::move(DictionaryBuilder().Set( + "resources", std::move(ListBuilder().Append("foo.js"))))) .Build(); scoped_refptr<Extension> shared_module_2 = ExtensionBuilder() @@ -249,10 +249,11 @@ TEST_F(SharedModuleServiceUnitTest, WhitelistedImports) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - DictionaryBuilder() - .Set("whitelist", - std::move(ListBuilder().Append(whitelisted_id))) - .Set("resources", std::move(ListBuilder().Append("*")))) + std::move( + DictionaryBuilder() + .Set("whitelist", + std::move(ListBuilder().Append(whitelisted_id))) + .Set("resources", std::move(ListBuilder().Append("*"))))) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder() diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc index b9c80bc..930119b 100644 --- a/chrome/browser/extensions/test_extension_environment.cc +++ b/chrome/browser/extensions/test_extension_environment.cc @@ -58,11 +58,11 @@ scoped_ptr<base::DictionaryValue> MakePackagedAppManifest() { .Set("name", "Test App Name") .Set("version", "2.0") .Set("manifest_version", 2) - .Set("app", extensions::DictionaryBuilder().Set( + .Set("app", std::move(extensions::DictionaryBuilder().Set( "background", - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))) + "background.js"))))))) .Build(); } diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc index badcddc..7d6d9773 100644 --- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc @@ -140,17 +140,19 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) { // app to run on a declared URL, but we don't know the port ahead of time. scoped_refptr<const Extension> hosted_app = ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", "hosted app") .Set("version", "1") .Set("app", - DictionaryBuilder() - .Set("urls", std::move(ListBuilder().Append( - kInstallUrl.spec()))) - .Set("launch", DictionaryBuilder().Set( - "web_url", kInstallUrl.spec()))) - .Set("manifest_version", 2)) + std::move( + DictionaryBuilder() + .Set("urls", std::move(ListBuilder().Append( + kInstallUrl.spec()))) + .Set("launch", + std::move(DictionaryBuilder().Set( + "web_url", kInstallUrl.spec()))))) + .Set("manifest_version", 2))) .Build(); ASSERT_TRUE(hosted_app.get()); diff --git a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc index 1a7f34c..77d89cd 100644 --- a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc @@ -48,28 +48,29 @@ class TestExtensionsMetricsProvider : public ExtensionsMetricsProvider { new extensions::ExtensionSet()); scoped_refptr<const extensions::Extension> extension; extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .SetID("ahfgeienlihckogmohjhadlkjgocpleb") .Build(); extensions->Insert(extension); extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "Test extension 2") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "Test extension 2") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) .SetID("pknkgggnfecklokoggaggchhaebkajji") .Build(); extensions->Insert(extension); - extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "Colliding Extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2)) - .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") - .Build(); + extension = + extensions::ExtensionBuilder() + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "Colliding Extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2))) + .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") + .Build(); extensions->Insert(extension); return extensions.Pass(); } diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc index 225c7d9..13c84c93 100644 --- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc +++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc @@ -201,70 +201,71 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) { // Baf is a hosted app which should not appear in the notifier list. const std::string kBafId = "dddddddddddddddddddddddddddddddd"; - foo_app.SetManifest( + foo_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.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"))))))) .Set("permissions", - std::move(extensions::ListBuilder().Append("notifications")))); + std::move(extensions::ListBuilder().Append("notifications"))))); foo_app.SetID(kFooId); extension_service->AddExtension(foo_app.Build().get()); extensions::ExtensionBuilder bar_app; - bar_app.SetManifest( + bar_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.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"))))))) .Set("permissions", - std::move(extensions::ListBuilder().Append("notifications")))); + std::move(extensions::ListBuilder().Append("notifications"))))); bar_app.SetID(kBarId); extension_service->AddExtension(bar_app.Build().get()); extensions::ExtensionBuilder baz_app; - baz_app.SetManifest( + baz_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "baz") .Set("version", "1.0.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"))))))))); baz_app.SetID(kBazId); extension_service->AddExtension(baz_app.Build().get()); extensions::ExtensionBuilder baf_app; - baf_app.SetManifest( + baf_app.SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "baf") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("app", - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "urls", std::move(extensions::ListBuilder().Append( - "http://localhost/extensions/hosted_app/main.html")))) - .Set("launch", - extensions::DictionaryBuilder().Set( - "urls", - std::move(extensions::ListBuilder().Append( - "http://localhost/extensions/hosted_app/main.html"))))); + "http://localhost/extensions/hosted_app/main.html"))))) + .Set( + "launch", + std::move(extensions::DictionaryBuilder().Set( + "urls", + std::move(extensions::ListBuilder().Append( + "http://localhost/extensions/hosted_app/main.html"))))))); baf_app.SetID(kBafId); extension_service->AddExtension(baf_app.Build().get()); diff --git a/chrome/browser/notifications/platform_notification_service_unittest.cc b/chrome/browser/notifications/platform_notification_service_unittest.cc index 06c9066..5f303bb 100644 --- a/chrome/browser/notifications/platform_notification_service_unittest.cc +++ b/chrome/browser/notifications/platform_notification_service_unittest.cc @@ -290,11 +290,11 @@ TEST_F(PlatformNotificationServiceTest, DisplayNameForContextMessage) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID("honijodknafkokifofgiaalefdiedpko") - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension")) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension"))) .Build(); extensions::ExtensionRegistry* registry = @@ -328,14 +328,15 @@ TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) { // Create a mocked extension that has the notifications API permission. scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension") - .Set("permissions", - std::move(extensions::ListBuilder().Append( - "notifications")))) + .SetManifest( + std::move(extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension") + .Set("permissions", + std::move(extensions::ListBuilder().Append( + "notifications"))))) .Build(); // Install the extension on the faked extension service, and verify that it @@ -377,11 +378,11 @@ TEST_F(PlatformNotificationServiceTest, CreateNotificationFromData) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID("honijodknafkokifofgiaalefdiedpko") - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension")) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension"))) .Build(); extensions::ExtensionRegistry* registry = diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc index 1105262..f3d238c 100644 --- a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc +++ b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc @@ -80,40 +80,45 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, ApplyPolicySettings) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/")) - .Append(extensions::DictionaryBuilder() - .Set("name", "Empty Folder") - .Set("children", extensions::ListBuilder())) - .Append( + .Append(std::move(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/"))) + .Append(std::move(extensions::DictionaryBuilder() + .Set("name", "Empty Folder") + .Set("children", extensions::ListBuilder()))) + .Append(std::move( extensions::DictionaryBuilder() .Set("name", "Big Folder") .Set( "children", std::move( extensions::ListBuilder() - .Append(extensions::DictionaryBuilder() - .Set("name", "Youtube") - .Set("url", "http://youtube.com/")) - .Append(extensions::DictionaryBuilder() - .Set("name", "Chromium") - .Set("url", "http://chromium.org/")) - .Append( + .Append(std::move( + extensions::DictionaryBuilder() + .Set("name", "Youtube") + .Set("url", "http://youtube.com/"))) + .Append(std::move( + extensions::DictionaryBuilder() + .Set("name", "Chromium") + .Set("url", "http://chromium.org/"))) + .Append(std::move( extensions::DictionaryBuilder() .Set("name", "More Stuff") - .Set("children", - std::move( - extensions::ListBuilder().Append( - extensions:: - DictionaryBuilder() - .Set("name", "Bugs") - .Set("url", - "http://" - "crbug.com/") - .Pass()))) - .Pass()))) - .Pass()) + .Set( + "children", + std::move( + extensions::ListBuilder().Append( + std::move( + extensions:: + DictionaryBuilder() + .Set("name", + "Bugs") + .Set( + "url", + "http://" + "crbug." + "com" + "/"))))))))))) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } @@ -163,9 +168,9 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, UnknownKeys) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/")) + .Append(std::move(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/"))) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } @@ -206,9 +211,9 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, BadBookmark) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/")) + .Append(std::move(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/"))) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } diff --git a/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc index 27e0518..4de21e2 100644 --- a/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc @@ -82,12 +82,12 @@ void ExtensionTestingProfile::AddExtension(std::string extension_id, scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID(extension_id) - .SetManifest(extensions::DictionaryBuilder() - .Set("name", extension_name) - .Set("version", version) - .Set("manifest_version", 2) - .Set("description", description) - .Set("update_url", update_url)) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", extension_name) + .Set("version", version) + .Set("manifest_version", 2) + .Set("description", description) + .Set("update_url", update_url))) .Build(); // Install the extension on the faked extension service. diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc index c871e1e..c8de976 100644 --- a/chrome/browser/site_details_browsertest.cc +++ b/chrome/browser/site_details_browsertest.cc @@ -130,8 +130,8 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { if (has_background_process) { manifest.Set( "background", - DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append("script.js")))); + std::move(DictionaryBuilder().Set( + "scripts", std::move(ListBuilder().Append("script.js"))))); dir->WriteFile(FILE_PATH_LITERAL("script.js"), "console.log('" + name + " running');"); } @@ -179,10 +179,11 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { .Set("version", "1.0") .Set("manifest_version", 2) .Set("app", - DictionaryBuilder() - .Set("urls", std::move(ListBuilder().Append(app_url.spec()))) - .Set("launch", - DictionaryBuilder().Set("web_url", app_url.spec()))); + std::move(DictionaryBuilder() + .Set("urls", + std::move(ListBuilder().Append(app_url.spec()))) + .Set("launch", std::move(DictionaryBuilder().Set( + "web_url", app_url.spec()))))); dir->WriteManifest(manifest.ToJSON()); const Extension* extension = LoadExtension(dir->unpacked_path()); diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc index 196313d..6bed5bf 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc @@ -204,12 +204,12 @@ TEST_F(SyncWorkerTest, UpdateRegisteredApps) { for (int i = 0; i < 3; i++) { scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2)) - .SetID(base::StringPrintf("app_%d", i)) - .Build(); + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2))) + .SetID(base::StringPrintf("app_%d", i)) + .Build(); extension_service()->AddExtension(extension.get()); GURL origin = extensions::Extension::GetBaseURLFromExtensionId( extension->id()); diff --git a/chrome/browser/ui/ash/keyboard_controller_browsertest.cc b/chrome/browser/ui/ash/keyboard_controller_browsertest.cc index b2f0afc..c5c6dec 100644 --- a/chrome/browser/ui/ash/keyboard_controller_browsertest.cc +++ b/chrome/browser/ui/ash/keyboard_controller_browsertest.cc @@ -157,10 +157,10 @@ IN_PROC_BROWSER_TEST_F(VirtualKeyboardAppWindowTest, DisableOverscrollForImeWindow) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "test extension") - .Set("version", "1") - .Set("manifest_version", 2)) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "test extension") + .Set("version", "1") + .Set("manifest_version", 2))) .Build(); extensions::AppWindow::CreateParams non_ime_params; diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index c524f1f..75629f5 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -78,41 +78,36 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { manifest.Set("manifest_version", 2); switch (type) { case PAGE_ACTION: - manifest.Set("page_action", DictionaryBuilder().Pass()); + manifest.Set("page_action", DictionaryBuilder()); break; case BROWSER_ACTION: - manifest.Set("browser_action", DictionaryBuilder().Pass()); + manifest.Set("browser_action", DictionaryBuilder()); break; case APP: - manifest.Set( - "app", - DictionaryBuilder().Set( - "launch", - DictionaryBuilder().Set("web_url", "http://www.example.com"))); + manifest.Set("app", + std::move(DictionaryBuilder().Set( + "launch", std::move(DictionaryBuilder().Set( + "web_url", "http://www.example.com"))))); break; } if (has_keybinding) { DictionaryBuilder command; - command.Set( - type == PAGE_ACTION ? "_execute_page_action" - : "_execute_browser_action", - DictionaryBuilder() - .Set( - "suggested_key", - DictionaryBuilder() - .Set("mac", "MacCtrl+Shift+E") - .Set("default", "Ctrl+Shift+E")) - .Pass()); - manifest.Set("commands", command.Pass()); + command.Set(type == PAGE_ACTION ? "_execute_page_action" + : "_execute_browser_action", + std::move(DictionaryBuilder().Set( + "suggested_key", + std::move(DictionaryBuilder() + .Set("mac", "MacCtrl+Shift+E") + .Set("default", "Ctrl+Shift+E"))))); + manifest.Set("commands", std::move(command)); } - extension_ = - extensions::ExtensionBuilder() - .SetManifest(manifest.Pass()) - .SetID(crx_file::id_util::GenerateId("foo")) - .SetLocation(location) - .Build(); + extension_ = extensions::ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetID(crx_file::id_util::GenerateId("foo")) + .SetLocation(location) + .Build(); extensionService_->AddExtension(extension_.get()); if (has_keybinding) { // Slight hack: manually notify the command service of the extension since diff --git a/chrome/browser/ui/location_bar/location_bar_browsertest.cc b/chrome/browser/ui/location_bar/location_bar_browsertest.cc index 4db53f1..abb981d 100644 --- a/chrome/browser/ui/location_bar/location_bar_browsertest.cc +++ b/chrome/browser/ui/location_bar/location_bar_browsertest.cc @@ -145,18 +145,19 @@ IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest, // Create and install an extension that overrides the bookmark star. extensions::DictionaryBuilder chrome_ui_overrides; - chrome_ui_overrides.Set( - "bookmarks_ui", - extensions::DictionaryBuilder().SetBoolean("remove_button", true)); + chrome_ui_overrides.Set("bookmarks_ui", + std::move(extensions::DictionaryBuilder().SetBoolean( + "remove_button", true))); scoped_refptr<const extensions::Extension> extension = - extensions::ExtensionBuilder(). - SetManifest(extensions::DictionaryBuilder(). - Set("name", "overrides star"). - Set("manifest_version", 2). - Set("version", "0.1"). - Set("description", "override the star"). - Set("chrome_ui_overrides", - chrome_ui_overrides.Pass())).Build(); + extensions::ExtensionBuilder() + .SetManifest(std::move( + extensions::DictionaryBuilder() + .Set("name", "overrides star") + .Set("manifest_version", 2) + .Set("version", "0.1") + .Set("description", "override the star") + .Set("chrome_ui_overrides", std::move(chrome_ui_overrides)))) + .Build(); extension_service()->AddExtension(extension.get()); // The star should now be hidden. diff --git a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc index da56b5d..d731e92 100644 --- a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc +++ b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc @@ -40,11 +40,11 @@ scoped_refptr<const extensions::Extension> CreateExtension( Set("manifest_version", 2). Set("version", "1.0"); if (has_browser_action) - manifest.Set("browser_action", extensions::DictionaryBuilder().Pass()); - return extensions::ExtensionBuilder(). - SetManifest(manifest.Pass()). - SetID(crx_file::id_util::GenerateId(name)). - Build(); + manifest.Set("browser_action", extensions::DictionaryBuilder()); + return extensions::ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetID(crx_file::id_util::GenerateId(name)) + .Build(); } } // namespace diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc index bdf48e8..f7fa582 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc @@ -1194,10 +1194,10 @@ TEST_F(ToolbarActionsModelUnitTest, ComponentExtensionsAddedToEnd) { .Set("description", "An extension") .Set("manifest_version", 2) .Set("version", "1.0.0") - .Set("browser_action", extensions::DictionaryBuilder().Pass()); + .Set("browser_action", extensions::DictionaryBuilder()); scoped_refptr<const extensions::Extension> component_extension = extensions::ExtensionBuilder() - .SetManifest(manifest.Pass()) + .SetManifest(std::move(manifest)) .SetID(crx_file::id_util::GenerateId(kName)) .SetLocation(extensions::Manifest::COMPONENT) .Build(); diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc index 439ce7d..5296fba 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc @@ -45,11 +45,11 @@ class AppInfoPermissionsPanelTest : public testing::Test { .Set("version", "2.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"))))))) .Build(); } @@ -136,9 +136,9 @@ TEST_F(AppInfoPermissionsPanelTest, RetainedFilePermissionsObtainedCorrectly) { .MergeManifest(extensions::DictionaryBuilder().Set( "permissions", std::move(extensions::ListBuilder().Append( - extensions::DictionaryBuilder().Set( + std::move(extensions::DictionaryBuilder().Set( "fileSystem", std::move(extensions::ListBuilder().Append( - "retainEntries"))))))) + "retainEntries")))))))) .SetID(kTestExtensionId) .Build(); AppInfoPermissionsPanel panel(&profile_, app.get()); diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc index 9ebd960..d6b8199 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc @@ -16,9 +16,9 @@ namespace { scoped_refptr<extensions::Extension> BuildTestExtension() { return extensions::ExtensionBuilder() - .SetManifest(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0")) + .SetManifest(std::move(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0"))) .Build(); } diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc index b7ae8a1..3830cdc 100644 --- a/chrome/browser/ui/webui/policy_ui_browsertest.cc +++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc @@ -309,11 +309,11 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, ExtensionLoadAndSendPolicy) { manifest.Set("name", "test") .Set("version", "1") .Set("manifest_version", 2) - .Set("storage", storage); + .Set("storage", std::move(storage)); extensions::ExtensionBuilder builder; builder.SetPath(temp_dir_.path()); - builder.SetManifest(manifest); + builder.SetManifest(std::move(manifest)); // Install extension. ExtensionService* service = extensions::ExtensionSystem::Get( diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc index 8866763..9be255d 100644 --- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc +++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc @@ -351,7 +351,7 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated( continue; } - printer_list.Append( + printer_list.Append(std::move( DictionaryBuilder() .Set("id", GenerateProvisionalUsbPrinterId(extension.get(), device.get())) @@ -362,7 +362,7 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated( device->product_string(), base::string16(), false)) .Set("extensionId", extension->id()) .Set("extensionName", extension->name()) - .Set("provisional", true)); + .Set("provisional", true))); } } } diff --git a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc index 05c2e1a..7a15a01 100644 --- a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc +++ b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc @@ -64,13 +64,13 @@ IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, HistoryOverride) { scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( extensions::DictionaryBuilder() .Set("name", "History Override") .Set("version", "1") .Set("manifest_version", 2) .Set("permission", - std::move(extensions::ListBuilder().Append("history")))) + std::move(extensions::ListBuilder().Append("history"))))) .Build(); ExtensionService* service = extensions::ExtensionSystem::Get( diff --git a/chrome/common/extensions/api/common_extension_api_unittest.cc b/chrome/common/extensions/api/common_extension_api_unittest.cc index 47d89e6..25a5d81 100644 --- a/chrome/common/extensions/api/common_extension_api_unittest.cc +++ b/chrome/common/extensions/api/common_extension_api_unittest.cc @@ -202,22 +202,24 @@ TEST(ExtensionAPITest, APIFeatures) { TEST(ExtensionAPITest, IsAnyFeatureAvailableToContext) { scoped_refptr<const Extension> app = ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", "app") - .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"))))))) .Set("version", "1") - .Set("manifest_version", 2)) + .Set("manifest_version", 2))) + .Build(); + scoped_refptr<const Extension> extension = + ExtensionBuilder() + .SetManifest(std::move(DictionaryBuilder() + .Set("name", "extension") + .Set("version", "1") + .Set("manifest_version", 2))) .Build(); - scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "extension") - .Set("version", "1") - .Set("manifest_version", 2)).Build(); struct { std::string api_full_name; @@ -827,8 +829,8 @@ TEST(ExtensionAPITest, ManifestKeys) { scoped_refptr<Extension> extension = BuildExtension(ExtensionBuilder()) - .MergeManifest(DictionaryBuilder().Set("browser_action", - DictionaryBuilder().Pass())) + .MergeManifest( + DictionaryBuilder().Set("browser_action", DictionaryBuilder())) .Build(); EXPECT_TRUE(extension_api->IsAvailable("browserAction", diff --git a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc index ea7b4be..69972a3 100644 --- a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc @@ -25,13 +25,14 @@ TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_NoDefaultIcons) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "No default properties") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("browser_action", DictionaryBuilder() - .Set("default_title", "Title"))) - .Build(); + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "No default properties") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("browser_action", std::move(DictionaryBuilder().Set( + "default_title", "Title"))))) + .Build(); ASSERT_TRUE(extension.get()); const ActionInfo* browser_action_info = @@ -44,13 +45,14 @@ TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_StringDefaultIcon) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "String default icon") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("browser_action", DictionaryBuilder() - .Set("default_icon", "icon.png"))) - .Build(); + .SetManifest(std::move( + DictionaryBuilder() + .Set("name", "String default icon") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("browser_action", std::move(DictionaryBuilder().Set( + "default_icon", "icon.png"))))) + .Build(); ASSERT_TRUE(extension.get()); const ActionInfo* browser_action_info = @@ -70,17 +72,18 @@ TEST_F(BrowserActionManifestTest, // Arbitrary sizes should be allowed (useful for various scale factors). scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest( + .SetManifest(std::move( DictionaryBuilder() .Set("name", "Dictionary default icon") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("browser_action", - DictionaryBuilder().Set("default_icon", - DictionaryBuilder() - .Set("19", "icon19.png") - .Set("24", "icon24.png") - .Set("38", "icon38.png")))) + std::move(DictionaryBuilder().Set( + "default_icon", + std::move(DictionaryBuilder() + .Set("19", "icon19.png") + .Set("24", "icon24.png") + .Set("38", "icon38.png"))))))) // Don't check for existence of icons during parsing. .SetLocation(Manifest::UNPACKED) .Build(); @@ -102,14 +105,19 @@ TEST_F(BrowserActionManifestTest, TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_InvalidDefaultIcon) { - scoped_ptr<base::DictionaryValue> manifest_value = DictionaryBuilder() - .Set("name", "Invalid default icon").Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("browser_action", - DictionaryBuilder().Set( - "default_icon", - DictionaryBuilder().Set("19", std::string()) // Invalid value. - .Set("24", "icon24.png").Set("38", "icon38.png"))).Build(); + scoped_ptr<base::DictionaryValue> manifest_value = + DictionaryBuilder() + .Set("name", "Invalid default icon") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("browser_action", + std::move(DictionaryBuilder().Set( + "default_icon", + std::move(DictionaryBuilder() + .Set("19", std::string()) // Invalid value. + .Set("24", "icon24.png") + .Set("38", "icon38.png"))))) + .Build(); base::string16 error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidIconPath, "19"); diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc index 11886ad..2c7b91c 100644 --- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc +++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc @@ -36,14 +36,14 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) { .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append( + std::move(extensions::ListBuilder().Append(std::move( extensions::DictionaryBuilder() .Set("id", "open") .Set("default_title", "open") .Set("file_filters", std::move(extensions::ListBuilder() .Append("filesystem:*.txt") - .Append("filesystem:*.html")))))); + .Append("filesystem:*.html"))))))); scoped_ptr<base::DictionaryValue> bad_manifest_value( bad_manifest_builder.Build()); @@ -61,7 +61,7 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) { EXPECT_FALSE(FileBrowserHandler::GetHandlers(bad_app.get())); extensions::ExtensionBuilder good_app_builder; - good_app_builder.SetManifest(good_manifest_builder); + good_app_builder.SetManifest(std::move(good_manifest_builder)); scoped_refptr<extensions::Extension> good_app(good_app_builder.Build()); EXPECT_TRUE(FileBrowserHandler::GetHandlers(good_app.get())); } @@ -102,22 +102,23 @@ TEST_F(FileBrowserHandlerManifestTest, InvalidFileBrowserHandlers) { TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandler) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "file browser handler test") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("permissions", - std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) - .Set("file_browser_handlers", - std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("id", "ExtremelyCoolAction") - .Set("default_title", "Be Amazed") - .Set("default_icon", "icon.png") - .Set("file_filters", - std::move(ListBuilder().Append( - "filesystem:*.txt"))))))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", "file browser handler test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", + std::move(extensions::ListBuilder().Append( + "fileBrowserHandler"))) + .Set("file_browser_handlers", + std::move(ListBuilder().Append(std::move( + DictionaryBuilder() + .Set("id", "ExtremelyCoolAction") + .Set("default_title", "Be Amazed") + .Set("default_icon", "icon.png") + .Set("file_filters", + std::move(ListBuilder().Append( + "filesystem:*.txt"))))))))) .Build(); ASSERT_TRUE(extension.get()); @@ -143,22 +144,23 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetID(extension_misc::kQuickOfficeExtensionId) - .SetManifest(DictionaryBuilder() - .Set("name", "file browser handler test") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("permissions", - std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) - .Set("file_browser_handlers", - std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("id", "ID") - .Set("default_title", "Default title") - .Set("default_icon", "icon.png") - .Set("file_filters", - std::move(ListBuilder().Append( - "filesystem:*.txt"))))))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", "file browser handler test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", + std::move(extensions::ListBuilder().Append( + "fileBrowserHandler"))) + .Set("file_browser_handlers", + std::move(ListBuilder().Append(std::move( + DictionaryBuilder() + .Set("id", "ID") + .Set("default_title", "Default title") + .Set("default_icon", "icon.png") + .Set("file_filters", + std::move(ListBuilder().Append( + "filesystem:*.txt"))))))))) .Build(); ASSERT_TRUE(extension.get()); @@ -177,25 +179,26 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) { TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerWithCreate) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "file browser handler test create") - .Set("version", "1.0.0") - .Set("manifest_version", 2) - .Set("permissions", - std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) - .Set("file_browser_handlers", - std::move(ListBuilder().Append( - DictionaryBuilder() - .Set("id", "ID") - .Set("default_title", "Default title") - .Set("default_icon", "icon.png") - .Set("file_filters", - std::move(ListBuilder().Append( - "filesystem:*.txt"))) - .Set("file_access", - std::move(ListBuilder().Append( - "create"))))))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", "file browser handler test create") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", + std::move(extensions::ListBuilder().Append( + "fileBrowserHandler"))) + .Set("file_browser_handlers", + std::move(ListBuilder().Append(std::move( + DictionaryBuilder() + .Set("id", "ID") + .Set("default_title", "Default title") + .Set("default_icon", "icon.png") + .Set("file_filters", + std::move(ListBuilder().Append( + "filesystem:*.txt"))) + .Set("file_access", + std::move(ListBuilder().Append( + "create"))))))))) .Build(); ASSERT_TRUE(extension.get()); diff --git a/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc b/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc index 10540a3..febe87e 100644 --- a/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc +++ b/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc @@ -179,16 +179,18 @@ TEST_F(ChromeChannelFeatureFilterTest, SimpleFeatureAvailability) { DictionaryBuilder() .Set("feature1", std::move(ListBuilder() - .Append(DictionaryBuilder() - .Set("channel", "beta") - .Set("extension_types", - std::move(ListBuilder().Append( - "extension")))) - .Append(DictionaryBuilder() - .Set("channel", "beta") - .Set("extension_types", - std::move(ListBuilder().Append( - "legacy_packaged_app")))))) + .Append(std::move( + DictionaryBuilder() + .Set("channel", "beta") + .Set("extension_types", + std::move(ListBuilder().Append( + "extension"))))) + .Append(std::move( + DictionaryBuilder() + .Set("channel", "beta") + .Set("extension_types", + std::move(ListBuilder().Append( + "legacy_packaged_app"))))))) .Build()); scoped_ptr<BaseFeatureProvider> provider( diff --git a/chrome/common/pepper_permission_util_unittest.cc b/chrome/common/pepper_permission_util_unittest.cc index 7575fa2..a972daf 100644 --- a/chrome/common/pepper_permission_util_unittest.cc +++ b/chrome/common/pepper_permission_util_unittest.cc @@ -31,8 +31,8 @@ scoped_refptr<Extension> CreateExtensionImportingModule( .Set("name", "Has Dependent Modules") .Set("version", "1.0") .Set("manifest_version", 2) - .Set("import", std::move(ListBuilder().Append( - DictionaryBuilder().Set("id", import_id)))) + .Set("import", std::move(ListBuilder().Append(std::move( + DictionaryBuilder().Set("id", import_id))))) .Build(); return ExtensionBuilder() @@ -92,12 +92,13 @@ TEST(PepperPermissionUtilTest, SharedModuleWhitelisting) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - DictionaryBuilder() - .Set("resources", std::move(ListBuilder().Append("*"))) - // Add the extension to the whitelist. This - // restricts import to |whitelisted_id| only. - .Set("whitelist", - std::move(ListBuilder().Append(whitelisted_id)))) + std::move( + DictionaryBuilder() + .Set("resources", std::move(ListBuilder().Append("*"))) + // Add the extension to the whitelist. This + // restricts import to |whitelisted_id| only. + .Set("whitelist", + std::move(ListBuilder().Append(whitelisted_id))))) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder().SetManifest(shared_module_manifest.Pass()).Build(); diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc index 1dd8737..e390607 100644 --- a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc +++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc @@ -50,12 +50,13 @@ class RendererPermissionsPolicyDelegateTest : public testing::Test { scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "Extension with ID " + id) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", - std::move(ListBuilder().Append("<all_urls>")))) + .SetManifest( + std::move(DictionaryBuilder() + .Set("name", "Extension with ID " + id) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", + std::move(ListBuilder().Append("<all_urls>"))))) .SetID(id) .Build(); } 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( |