Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / common / pref_names_util.cc
blob70efc1b387cc5b32ca0b2f58687b90a04d59e52e
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.
5 #include "chrome/common/pref_names_util.h"
7 #include "base/strings/string_util.h"
9 namespace pref_names_util {
11 const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
13 bool ParseFontNamePrefPath(const std::string& pref_path,
14 std::string* generic_family,
15 std::string* script) {
16 if (!base::StartsWith(pref_path, kWebKitFontPrefPrefix,
17 base::CompareCase::SENSITIVE))
18 return false;
20 size_t start = strlen(kWebKitFontPrefPrefix);
21 size_t pos = pref_path.find('.', start);
22 if (pos == std::string::npos || pos + 1 == pref_path.length())
23 return false;
24 if (generic_family)
25 *generic_family = pref_path.substr(start, pos - start);
26 if (script)
27 *script = pref_path.substr(pos + 1);
28 return true;
31 } // namespace pref_names_util