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

Unified Diff: components/favicon_base/fallback_icon_style.h

Issue 886163003: [Favicon] Add FallbackIconStyle and FallbackIconService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving FallbackIconStyle to its own file to fix Skia dependency issues. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/favicon_base/fallback_icon_style.h
diff --git a/components/favicon_base/fallback_icon_style.h b/components/favicon_base/fallback_icon_style.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a69af2259726a75e4fbdbd023964a44ca9b5c40
--- /dev/null
+++ b/components/favicon_base/fallback_icon_style.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_
+#define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+
+namespace favicon_base {
+
+// Styling specifications of a fallback icon. The icon is composed of a solid
+// rounded square containing a single letter. The specification excludes the
+// icon URL and size, which are given when the icon is rendered.
+struct FallbackIconStyle {
stevenjb 2015/02/11 18:04:37 From the style guide: "Use a struct only for passi
huangs 2015/02/11 20:28:39 I want the ability to directly access member varia
+ FallbackIconStyle();
+ ~FallbackIconStyle();
+
+ // Reassigns |text_color| so it matches well with |background_color|.
+ void MatchTextColorWithBackgroundColor();
+
+ // If any member changes, also update FallbackIconStyleBuilder.
+
+ // Returns true if values stored are within bounds.
+ bool is_valid() const;
+
+ // Icon background fill color.
+ SkColor background_color;
+
+ // Icon text color.
+ SkColor text_color;
+
+ // Ratio in [0.0, 1.0] of the text font size (pixels) to the icon size.
+ double font_size_ratio;
+
+ // The roundness of the icon's corners. 0 => square icon, 1 => circle icon.
+ double roundness;
+};
+
+} // namespace favicon_base
+
+#endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_

Powered by Google App Engine
This is Rietveld 408576698