Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Unified Diff: chrome/browser/extensions/convert_web_app.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/convert_web_app.cc
diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc
index 500f56974e003ee04e7f9963525bf170fe5d8105..e8304f2eb4f1b02f48e44d509ead28c1c9573886 100644
--- a/chrome/browser/extensions/convert_web_app.cc
+++ b/chrome/browser/extensions/convert_web_app.cc
@@ -20,10 +20,12 @@
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "base/values.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/web_application_info.h"
#include "crypto/sha2.h"
@@ -116,10 +118,8 @@ scoped_refptr<Extension> ConvertWebAppToExtension(
}
// Add the icons and linked icon information.
- base::DictionaryValue* icons = new base::DictionaryValue();
- root->Set(keys::kIcons, icons);
- base::ListValue* linked_icons = new base::ListValue();
- root->Set(keys::kLinkedAppIcons, linked_icons);
+ auto icons = base::MakeUnique<base::DictionaryValue>();
+ auto linked_icons = base::MakeUnique<base::ListValue>();
for (const auto& icon : web_app.icons) {
std::string size = base::StringPrintf("%i", icon.width);
std::string icon_path = base::StringPrintf("%s/%s.png", kIconsDirName,
@@ -134,6 +134,8 @@ scoped_refptr<Extension> ConvertWebAppToExtension(
linked_icons->Append(std::move(linked_icon));
}
}
+ root->Set(keys::kIcons, std::move(icons));
+ root->Set(keys::kLinkedAppIcons, std::move(linked_icons));
// Write the manifest.
base::FilePath manifest_path = temp_dir.GetPath().Append(kManifestFilename);
« no previous file with comments | « chrome/browser/extensions/convert_user_script.cc ('k') | chrome/browser/extensions/extension_assets_manager_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698