OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/extensions/bookmark_app_helper.h" | 5 #include "chrome/browser/extensions/bookmark_app_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cctype> | 9 #include <cctype> |
10 #include <string> | 10 #include <string> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 const size_t font_size = output_size_ * 7 / 16; | 102 const size_t font_size = output_size_ * 7 / 16; |
103 | 103 |
104 std::string font_name = | 104 std::string font_name = |
105 l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY); | 105 l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY); |
106 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
107 const std::string kChromeOSFontFamily = "Noto Sans"; | 107 const std::string kChromeOSFontFamily = "Noto Sans"; |
108 font_name = kChromeOSFontFamily; | 108 font_name = kChromeOSFontFamily; |
109 #endif | 109 #endif |
110 | 110 |
111 // Draw a rounded rect of the given |color|. | 111 // Draw a rounded rect of the given |color|. |
112 SkPaint background_paint; | 112 cc::PaintFlags background_paint; |
113 background_paint.setFlags(SkPaint::kAntiAlias_Flag); | 113 background_paint.setAntiAlias(true); |
vmpstr
2017/01/25 22:42:11
tbh, the implementation of setAntiAlias is more co
| |
114 background_paint.setColor(color_); | 114 background_paint.setColor(color_); |
115 | 115 |
116 gfx::Rect icon_rect(icon_inset, icon_inset, icon_size, icon_size); | 116 gfx::Rect icon_rect(icon_inset, icon_inset, icon_size, icon_size); |
117 canvas->DrawRoundRect(icon_rect, border_radius, background_paint); | 117 canvas->DrawRoundRect(icon_rect, border_radius, background_paint); |
118 | 118 |
119 // The text rect's size needs to be odd to center the text correctly. | 119 // The text rect's size needs to be odd to center the text correctly. |
120 gfx::Rect text_rect(icon_inset, icon_inset, icon_size + 1, icon_size + 1); | 120 gfx::Rect text_rect(icon_inset, icon_inset, icon_size + 1, icon_size + 1); |
121 // Draw the letter onto the rounded rect. The letter's color depends on the | 121 // Draw the letter onto the rounded rect. The letter's color depends on the |
122 // luma of |color|. | 122 // luma of |color|. |
123 const uint8_t luma = color_utils::GetLuma(color_); | 123 const uint8_t luma = color_utils::GetLuma(color_); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 808 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
809 } | 809 } |
810 | 810 |
811 bool IsValidBookmarkAppUrl(const GURL& url) { | 811 bool IsValidBookmarkAppUrl(const GURL& url) { |
812 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); | 812 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); |
813 origin_only_pattern.SetMatchAllURLs(true); | 813 origin_only_pattern.SetMatchAllURLs(true); |
814 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 814 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
815 } | 815 } |
816 | 816 |
817 } // namespace extensions | 817 } // namespace extensions |
OLD | NEW |