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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 2697663002: Clean up naming of paint-related identifiers (Closed)
Patch Set: Rebase Created 3 years, 10 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
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const size_t font_size = output_size_ * 7 / 16; 104 const size_t font_size = output_size_ * 7 / 16;
105 105
106 std::string font_name = 106 std::string font_name =
107 l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY); 107 l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY);
108 #if defined(OS_CHROMEOS) 108 #if defined(OS_CHROMEOS)
109 const std::string kChromeOSFontFamily = "Noto Sans"; 109 const std::string kChromeOSFontFamily = "Noto Sans";
110 font_name = kChromeOSFontFamily; 110 font_name = kChromeOSFontFamily;
111 #endif 111 #endif
112 112
113 // Draw a rounded rect of the given |color|. 113 // Draw a rounded rect of the given |color|.
114 cc::PaintFlags background_paint; 114 cc::PaintFlags background_flags;
115 background_paint.setAntiAlias(true); 115 background_flags.setAntiAlias(true);
116 background_paint.setColor(color_); 116 background_flags.setColor(color_);
117 117
118 gfx::Rect icon_rect(icon_inset, icon_inset, icon_size, icon_size); 118 gfx::Rect icon_rect(icon_inset, icon_inset, icon_size, icon_size);
119 canvas->DrawRoundRect(icon_rect, border_radius, background_paint); 119 canvas->DrawRoundRect(icon_rect, border_radius, background_flags);
120 120
121 // The text rect's size needs to be odd to center the text correctly. 121 // The text rect's size needs to be odd to center the text correctly.
122 gfx::Rect text_rect(icon_inset, icon_inset, icon_size + 1, icon_size + 1); 122 gfx::Rect text_rect(icon_inset, icon_inset, icon_size + 1, icon_size + 1);
123 // Draw the letter onto the rounded rect. The letter's color depends on the 123 // Draw the letter onto the rounded rect. The letter's color depends on the
124 // luma of |color|. 124 // luma of |color|.
125 const uint8_t luma = color_utils::GetLuma(color_); 125 const uint8_t luma = color_utils::GetLuma(color_);
126 canvas->DrawStringRectWithFlags( 126 canvas->DrawStringRectWithFlags(
127 base::string16(1, std::toupper(letter_)), 127 base::string16(1, std::toupper(letter_)),
128 gfx::FontList(gfx::Font(font_name, font_size)), 128 gfx::FontList(gfx::Font(font_name, font_size)),
129 (luma > kLumaThreshold) ? SK_ColorBLACK : SK_ColorWHITE, 129 (luma > kLumaThreshold) ? SK_ColorBLACK : SK_ColorWHITE,
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 813 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
814 } 814 }
815 815
816 bool IsValidBookmarkAppUrl(const GURL& url) { 816 bool IsValidBookmarkAppUrl(const GURL& url) {
817 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); 817 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes);
818 origin_only_pattern.SetMatchAllURLs(true); 818 origin_only_pattern.SetMatchAllURLs(true);
819 return url.is_valid() && origin_only_pattern.MatchesURL(url); 819 return url.is_valid() && origin_only_pattern.MatchesURL(url);
820 } 820 }
821 821
822 } // namespace extensions 822 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_shelf.cc ('k') | chrome/browser/profiles/profile_avatar_icon_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698