OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // padding before the label. | 72 // padding before the label. |
73 virtual int GetImageAndPaddingWidth() const; | 73 virtual int GetImageAndPaddingWidth() const; |
74 | 74 |
75 // views::View: | 75 // views::View: |
76 gfx::Size GetPreferredSize() const override; | 76 gfx::Size GetPreferredSize() const override; |
77 void Layout() override; | 77 void Layout() override; |
78 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 78 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
79 | 79 |
80 const gfx::FontList& font_list() const { return label_->font_list(); } | 80 const gfx::FontList& font_list() const { return label_->font_list(); } |
81 | 81 |
| 82 bool IsInvertedColorScheme() const; |
| 83 |
82 gfx::Size GetSizeForLabelWidth(int width) const; | 84 gfx::Size GetSizeForLabelWidth(int width) const; |
83 | 85 |
84 private: | 86 private: |
85 // Amount of padding at the edges of the bubble. If |leading| is true, this | 87 // Amount of padding at the edges of the bubble. If |leading| is true, this |
86 // is the padding at the beginning of the bubble (left in LTR), otherwise it's | 88 // is the padding at the beginning of the bubble (left in LTR), otherwise it's |
87 // the end padding. | 89 // the end padding. |
88 int GetBubbleOuterPadding(bool leading) const; | 90 int GetBubbleOuterPadding(bool leading) const; |
89 | 91 |
90 // As above, but for Material Design. TODO(estade): remove/replace the above. | 92 // As above, but for Material Design. TODO(estade): remove/replace the above. |
91 int GetBubbleOuterPaddingMd(bool leading) const; | 93 int GetBubbleOuterPaddingMd(bool leading) const; |
92 | 94 |
93 // Sets a background color on |label_| based on |background_image_color| and | 95 // Sets a background color on |label_| based on |chip_background_color| and |
94 // |parent_background_color_|. | 96 // the parent's bg color. |
95 void SetLabelBackgroundColor(SkColor background_image_color); | 97 void SetLabelBackgroundColor(SkColor chip_background_color); |
96 | 98 |
97 // views::View: | 99 // views::View: |
98 const char* GetClassName() const override; | 100 const char* GetClassName() const override; |
99 void OnPaint(gfx::Canvas* canvas) override; | 101 void OnPaint(gfx::Canvas* canvas) override; |
100 | 102 |
101 // For painting the background. TODO(estade): remove post MD launch. | 103 // For painting the background. TODO(estade): remove post MD launch. |
102 scoped_ptr<views::Painter> background_painter_; | 104 scoped_ptr<views::Painter> background_painter_; |
103 | 105 |
104 // The contents of the bubble. | 106 // The contents of the bubble. |
105 views::ImageView* image_; | 107 views::ImageView* image_; |
106 views::Label* label_; | 108 views::Label* label_; |
107 | 109 |
108 bool is_extension_icon_; | 110 bool is_extension_icon_; |
109 | 111 |
| 112 // This is only used in pre-MD. In MD, the background color is derived from |
| 113 // the native theme (so it responds to native theme updates). TODO(estade): |
| 114 // remove when MD is default. |
110 SkColor parent_background_color_; | 115 SkColor parent_background_color_; |
111 | 116 |
112 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); | 117 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); |
113 }; | 118 }; |
114 | 119 |
115 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 120 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
OLD | NEW |