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

Side by Side Diff: chrome/common/pref_names_util.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/pref_names_util.h" 5 #include "chrome/common/pref_names_util.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 8
9 namespace pref_names_util { 9 namespace pref_names_util {
10 10
11 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts."; 11 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
12 12
13 bool ParseFontNamePrefPath(const std::string& pref_path, 13 bool ParseFontNamePrefPath(const std::string& pref_path,
14 std::string* generic_family, 14 std::string* generic_family,
15 std::string* script) { 15 std::string* script) {
16 if (!StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true)) 16 if (!base::StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true))
17 return false; 17 return false;
18 18
19 size_t start = strlen(kWebKitFontPrefPrefix); 19 size_t start = strlen(kWebKitFontPrefPrefix);
20 size_t pos = pref_path.find('.', start); 20 size_t pos = pref_path.find('.', start);
21 if (pos == std::string::npos || pos + 1 == pref_path.length()) 21 if (pos == std::string::npos || pos + 1 == pref_path.length())
22 return false; 22 return false;
23 if (generic_family) 23 if (generic_family)
24 *generic_family = pref_path.substr(start, pos - start); 24 *generic_family = pref_path.substr(start, pos - start);
25 if (script) 25 if (script)
26 *script = pref_path.substr(pos + 1); 26 *script = pref_path.substr(pos + 1);
27 return true; 27 return true;
28 } 28 }
29 29
30 } // namespace pref_names_util 30 } // namespace pref_names_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698