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

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

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/common/prerender_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h>
8
7 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
8 10
9 namespace pref_names_util { 11 namespace pref_names_util {
10 12
11 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts."; 13 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
12 14
13 bool ParseFontNamePrefPath(const std::string& pref_path, 15 bool ParseFontNamePrefPath(const std::string& pref_path,
14 std::string* generic_family, 16 std::string* generic_family,
15 std::string* script) { 17 std::string* script) {
16 if (!base::StartsWith(pref_path, kWebKitFontPrefPrefix, 18 if (!base::StartsWith(pref_path, kWebKitFontPrefPrefix,
17 base::CompareCase::SENSITIVE)) 19 base::CompareCase::SENSITIVE))
18 return false; 20 return false;
19 21
20 size_t start = strlen(kWebKitFontPrefPrefix); 22 size_t start = strlen(kWebKitFontPrefPrefix);
21 size_t pos = pref_path.find('.', start); 23 size_t pos = pref_path.find('.', start);
22 if (pos == std::string::npos || pos + 1 == pref_path.length()) 24 if (pos == std::string::npos || pos + 1 == pref_path.length())
23 return false; 25 return false;
24 if (generic_family) 26 if (generic_family)
25 *generic_family = pref_path.substr(start, pos - start); 27 *generic_family = pref_path.substr(start, pos - start);
26 if (script) 28 if (script)
27 *script = pref_path.substr(pos + 1); 29 *script = pref_path.substr(pos + 1);
28 return true; 30 return true;
29 } 31 }
30 32
31 } // namespace pref_names_util 33 } // namespace pref_names_util
OLDNEW
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/common/prerender_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698