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

Unified Diff: extensions/common/extension_l10n_util.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 4 years, 5 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: extensions/common/extension_l10n_util.cc
diff --git a/extensions/common/extension_l10n_util.cc b/extensions/common/extension_l10n_util.cc
index 492f283231cbf11646e6cff379ddaaca87058250..9701ea43fca6826e18ea3954e2863e1e5cce4914 100644
--- a/extensions/common/extension_l10n_util.cc
+++ b/extensions/common/extension_l10n_util.cc
@@ -16,6 +16,7 @@
#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"
#include "base/values.h"
@@ -270,11 +271,10 @@ bool LocalizeExtension(const base::FilePath& extension_path,
extensions::file_util::LoadMessageBundle(extension_path, default_locale,
error));
- if (!message_bundle.get() && !error->empty())
+ if (!message_bundle && !error->empty())
return false;
- if (message_bundle.get() &&
- !LocalizeManifest(*message_bundle, manifest, error))
+ if (message_bundle && !LocalizeManifest(*message_bundle, manifest, error))
return false;
return true;
@@ -287,7 +287,7 @@ bool AddLocale(const std::set<std::string>& chrome_locales,
std::string* error) {
// Accept name that starts with a . but don't add it to the list of supported
// locales.
- if (locale_name.find(".") == 0)
+ if (base::StartsWith(locale_name, ".", base::CompareCase::SENSITIVE))
return true;
if (chrome_locales.find(locale_name) == chrome_locales.end()) {
// Warn if there is an extension locale that's not in the Chrome list,
@@ -297,14 +297,13 @@ bool AddLocale(const std::set<std::string>& chrome_locales,
return true;
}
// Check if messages file is actually present (but don't check content).
- if (base::PathExists(locale_folder.Append(extensions::kMessagesFilename))) {
- valid_locales->insert(locale_name);
- } else {
+ if (!base::PathExists(locale_folder.Append(extensions::kMessagesFilename))) {
*error = base::StringPrintf("Catalog file is missing for locale %s.",
locale_name.c_str());
return false;
}
+ valid_locales->insert(locale_name);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698