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

Side by Side Diff: chrome/browser/favicon/chrome_fallback_icon_client.cc

Issue 996253002: [Fallback Icons] Refactor FallbackIconService to be a BrowserContext-level singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup; moving defensive code into FallbackIconSource and LargeIconSource. Created 5 years, 8 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
(Empty)
1 // Copyright 2015 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/browser/favicon/chrome_fallback_icon_client.h"
6
7 #include "base/i18n/case_conversion.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "grit/platform_locale_settings.h"
10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
11 #include "ui/base/l10n/l10n_util.h"
12 #include "url/gurl.h"
13
14 ChromeFallbackIconClient::ChromeFallbackIconClient() {
15 #if defined(OS_CHROMEOS)
16 font_list_.push_back("Noto Sans");
17 #elif defined(OS_IOS)
18 font_list_.push_back("Helvetica Neue");
19 #else
20 font_list_.push_back(l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY));
21 #endif
22 }
23
24 ChromeFallbackIconClient::~ChromeFallbackIconClient() {
25 }
26
27 const std::vector<std::string>& ChromeFallbackIconClient::GetFontNameList()
28 const {
29 return font_list_;
30 }
31
32 // Returns a single character to represent a page URL. To do this we take the
33 // first letter in a domain's name and make it upper case.
34 // TODO(huangs): Handle non-ASCII ("xn--") domain names.
pkotwicz 2015/03/27 03:52:09 Nit: Move the comment inside the function. Return
huangs 2015/03/27 17:33:07 Done, but keeping "Returns". My observation of the
35 base::string16 ChromeFallbackIconClient::GetFallbackIconText(const GURL& url)
36 const {
37 std::string domain = net::registry_controlled_domains::GetDomainAndRegistry(
38 url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
39 return domain.empty() ? base::string16() :
40 base::i18n::ToUpper(base::ASCIIToUTF16(domain.substr(0, 1)));
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698