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

Unified Diff: extensions/common/extension_l10n_util.cc

Issue 2500573003: Some easy linked_ptr removal from extensions/common/ (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « extensions/common/event_filter.cc ('k') | extensions/common/extension_l10n_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_l10n_util.cc
diff --git a/extensions/common/extension_l10n_util.cc b/extensions/common/extension_l10n_util.cc
index 9701ea43fca6826e18ea3954e2863e1e5cce4914..bf0194a4f6c409b115dfd7908337cb0c8b6567c9 100644
--- a/extensions/common/extension_l10n_util.cc
+++ b/extensions/common/extension_l10n_util.cc
@@ -15,7 +15,6 @@
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
-#include "base/memory/linked_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -36,9 +35,10 @@ namespace {
// Loads contents of the messages file for given locale. If file is not found,
// or there was parsing error we return NULL and set |error|.
// Caller owns the returned object.
-base::DictionaryValue* LoadMessageFile(const base::FilePath& locale_path,
- const std::string& locale,
- std::string* error) {
+std::unique_ptr<base::DictionaryValue> LoadMessageFile(
+ const base::FilePath& locale_path,
+ const std::string& locale,
+ std::string* error) {
base::FilePath file =
locale_path.AppendASCII(locale).Append(extensions::kMessagesFilename);
JSONFileValueDeserializer messages_deserializer(file);
@@ -59,7 +59,7 @@ base::DictionaryValue* LoadMessageFile(const base::FilePath& locale_path,
}
}
- return dictionary.release();
+ return dictionary;
}
// Localizes manifest value of string type for a given key.
@@ -376,21 +376,21 @@ extensions::MessageBundle* LoadMessageCatalogs(
GetAllFallbackLocales(
application_locale, default_locale, &all_fallback_locales);
- std::vector<linked_ptr<base::DictionaryValue> > catalogs;
+ std::vector<std::unique_ptr<base::DictionaryValue>> catalogs;
for (size_t i = 0; i < all_fallback_locales.size(); ++i) {
// Skip all parent locales that are not supplied.
base::FilePath this_locale_path =
locale_path.AppendASCII(all_fallback_locales[i]);
if (!base::PathExists(this_locale_path))
continue;
- linked_ptr<base::DictionaryValue> catalog(
- LoadMessageFile(locale_path, all_fallback_locales[i], error));
+ std::unique_ptr<base::DictionaryValue> catalog =
+ LoadMessageFile(locale_path, all_fallback_locales[i], error);
if (!catalog.get()) {
// If locale is valid, but messages.json is corrupted or missing, return
// an error.
- return NULL;
+ return nullptr;
} else {
- catalogs.push_back(catalog);
+ catalogs.push_back(std::move(catalog));
}
}
@@ -415,8 +415,8 @@ bool ValidateExtensionLocales(const base::FilePath& extension_path,
locale != valid_locales.end();
++locale) {
std::string locale_error;
- std::unique_ptr<base::DictionaryValue> catalog(
- LoadMessageFile(locale_path, *locale, &locale_error));
+ std::unique_ptr<base::DictionaryValue> catalog =
+ LoadMessageFile(locale_path, *locale, &locale_error);
if (!locale_error.empty()) {
if (!error->empty())
« no previous file with comments | « extensions/common/event_filter.cc ('k') | extensions/common/extension_l10n_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698