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

Unified Diff: chrome/test/chromedriver/chrome/browser_info.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict 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
« no previous file with comments | « chrome/renderer/pepper/pepper_uma_host.cc ('k') | chrome/test/chromedriver/chrome/chrome_desktop_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/browser_info.cc
diff --git a/chrome/test/chromedriver/chrome/browser_info.cc b/chrome/test/chromedriver/chrome/browser_info.cc
index 6938c3800a95035042bdba40582b3969eff2dd23..c790bfd5d6de310e73e5ff24d4d721de4ec0c562 100644
--- a/chrome/test/chromedriver/chrome/browser_info.cc
+++ b/chrome/test/chromedriver/chrome/browser_info.cc
@@ -16,7 +16,8 @@
namespace {
-const std::string kVersionPrefix = "Chrome/";
+const char kVersionPrefix[] = "Chrome/";
+const size_t kVersionPrefixLen = sizeof(kVersionPrefix) - 1;
} // namespace
@@ -86,8 +87,9 @@ Status ParseBrowserString(bool has_android_package,
}
int build_no = 0;
- if (browser_string.find(kVersionPrefix) == 0u) {
- std::string version = browser_string.substr(kVersionPrefix.length());
+ if (base::StartsWith(browser_string, kVersionPrefix,
+ base::CompareCase::SENSITIVE)) {
+ std::string version = browser_string.substr(kVersionPrefixLen);
Status status = ParseBrowserVersionString(
version, &browser_info->major_version, &build_no);
@@ -108,7 +110,7 @@ Status ParseBrowserString(bool has_android_package,
if (pos != std::string::npos) {
browser_info->browser_name = "webview";
browser_info->browser_version =
- browser_string.substr(pos + kVersionPrefix.length());
+ browser_string.substr(pos + kVersionPrefixLen);
browser_info->is_android = true;
return ParseBrowserVersionString(browser_info->browser_version,
&browser_info->major_version, &build_no);
« no previous file with comments | « chrome/renderer/pepper/pepper_uma_host.cc ('k') | chrome/test/chromedriver/chrome/chrome_desktop_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698