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

Unified Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 2121513002: Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos 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: chrome/browser/chromeos/profiles/profile_helper.cc
diff --git a/chrome/browser/chromeos/profiles/profile_helper.cc b/chrome/browser/chromeos/profiles/profile_helper.cc
index 08c4058c313c559c6f027ec55a996e65d74a9345..91ff48c42cd6d40251e1c900dc529c808b52e049 100644
--- a/chrome/browser/chromeos/profiles/profile_helper.cc
+++ b/chrome/browser/chromeos/profiles/profile_helper.cc
@@ -7,6 +7,7 @@
#include "base/barrier_closure.h"
#include "base/callback.h"
#include "base/command_line.h"
+#include "base/strings/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/browsing_data/browsing_data_remover.h"
@@ -138,13 +139,12 @@ std::string ProfileHelper::GetUserIdHashFromProfile(const Profile* profile) {
// Check that profile directory starts with the correct prefix.
std::string prefix(chrome::kProfileDirPrefix);
- if (profile_dir.find(prefix) != 0) {
+ if (!base::StartsWith(profile_dir, prefix, base::CompareCase::SENSITIVE)) {
// This happens when creating a TestingProfile in browser tests.
return std::string();
}
- return profile_dir.substr(prefix.length(),
- profile_dir.length() - prefix.length());
+ return profile_dir.substr(prefix.length());
}
// static

Powered by Google App Engine
This is Rietveld 408576698