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

Side by Side Diff: components/favicon_base/fallback_icon_style.h

Issue 2374753002: Track when fallback icon color is the default. (Closed)
Patch Set: Merge branch 'refs/heads/master' into default-color Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ 5 #ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_
6 #define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ 6 #define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_
7 7
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 10
11 namespace favicon_base { 11 namespace favicon_base {
12 12
13 // Styling specifications of a fallback icon. The icon is composed of a solid 13 // Styling specifications of a fallback icon. The icon is composed of a solid
14 // rounded square containing a single letter. The specification excludes the 14 // rounded square containing a single letter. The specification excludes the
15 // icon URL and size, which are given when the icon is rendered. 15 // icon URL and size, which are given when the icon is rendered.
16 struct FallbackIconStyle { 16 struct FallbackIconStyle {
17 FallbackIconStyle(); 17 FallbackIconStyle();
18 ~FallbackIconStyle(); 18 ~FallbackIconStyle();
19 19
20 // If any member changes, also update FallbackIconStyleBuilder. 20 // If any member changes, also update FallbackIconStyleBuilder.
21 21
22 // Icon background fill color. 22 // Icon background fill color.
23 SkColor background_color; 23 SkColor background_color;
24 bool is_default_background_color;
24 25
25 // Icon text color. 26 // Icon text color.
26 SkColor text_color; 27 SkColor text_color;
27 28
28 // Ratio in [0.0, 1.0] of the text font size (pixels) to the icon size. 29 // Ratio in [0.0, 1.0] of the text font size (pixels) to the icon size.
29 double font_size_ratio; 30 double font_size_ratio;
30 31
31 // The roundness of the icon's corners. 0 => square icon, 1 => circle icon. 32 // The roundness of the icon's corners. 0 => square icon, 1 => circle icon.
32 double roundness; 33 double roundness;
33 34
34 bool operator==(const FallbackIconStyle& other) const; 35 bool operator==(const FallbackIconStyle& other) const;
35 }; 36 };
36 37
37 // Reassigns |style|'s |text_color| to matches well against |background_color|. 38 // Reassigns |style|'s |text_color| to matches well against |background_color|.
38 void MatchFallbackIconTextColorAgainstBackgroundColor(FallbackIconStyle* style); 39 void MatchFallbackIconTextColorAgainstBackgroundColor(FallbackIconStyle* style);
39 40
40 // Returns whether |style| values are within bounds. 41 // Returns whether |style| values are within bounds.
41 bool ValidateFallbackIconStyle(const FallbackIconStyle& style); 42 bool ValidateFallbackIconStyle(const FallbackIconStyle& style);
42 43
43 // Set |style|'s background color to the dominant color of |bitmap_data|, 44 // Set |style|'s background color to the dominant color of |bitmap_data|,
44 // clamping luminance down to a reasonable maximum value so that light text is 45 // clamping luminance down to a reasonable maximum value so that light text is
45 // readable. 46 // readable.
46 void SetDominantColorAsBackground( 47 void SetDominantColorAsBackground(
47 const scoped_refptr<base::RefCountedMemory>& bitmap_data, 48 const scoped_refptr<base::RefCountedMemory>& bitmap_data,
48 FallbackIconStyle* style); 49 FallbackIconStyle* style);
49 50
50 } // namespace favicon_base 51 } // namespace favicon_base
51 52
52 #endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ 53 #endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_
OLDNEW
« no previous file with comments | « components/favicon/core/large_icon_service_unittest.cc ('k') | components/favicon_base/fallback_icon_style.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698