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

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

Issue 11336008: When a font family pref changes to the empty string, pass it to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/pref_names_util.h"
6
7 #include "base/string_util.h"
8
9 namespace {
Nico 2012/10/30 04:24:29 const has implicit internal linkage, no need for a
falken 2012/10/30 07:01:34 Done.
10
11 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
Nico 2012/10/30 04:24:29 Add a comment to pref_names.cc where the webkit.we
falken 2012/10/30 07:01:34 Done. I also rearranged the pref orders to make a
12
13 }
14
15 namespace pref_names_util {
16
17 bool ParseFontNamePrefPath(const std::string& pref_path,
18 std::string* generic_family,
19 std::string* script) {
20 if (!StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true))
21 return false;
22
23 size_t start = strlen(kWebKitFontPrefPrefix);
24 size_t pos = pref_path.find('.', start);
25 if (pos == std::string::npos || pos + 1 == pref_path.length())
26 return false;
27 if (generic_family)
28 *generic_family = pref_path.substr(start, pos - start);
29 if (script)
30 *script = pref_path.substr(pos + 1);
31 return true;
32 }
Nico 2012/10/30 04:24:29 no test for this?
falken 2012/10/30 07:01:34 I added a unit test. This was refactored out of t
33
34 } // namespace pref_names_util
OLDNEW
« chrome/common/pref_names_util.h ('K') | « chrome/common/pref_names_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698