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/macros.h" | 10 #include "base/macros.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 virtual bool ShouldShowBackground() const; | 67 virtual bool ShouldShowBackground() const; |
68 | 68 |
69 // Returns a multiplier used to calculate the actual width of the view based | 69 // Returns a multiplier used to calculate the actual width of the view based |
70 // on its desired width. This ranges from 0 for a zero-width view to 1 for a | 70 // on its desired width. This ranges from 0 for a zero-width view to 1 for a |
71 // full-width view and can be used to animate the width of the view. | 71 // full-width view and can be used to animate the width of the view. |
72 virtual double WidthMultiplier() const; | 72 virtual double WidthMultiplier() const; |
73 | 73 |
74 // Returns true when animation is in progress and is shrinking. | 74 // Returns true when animation is in progress and is shrinking. |
75 virtual bool IsShrinking() const; | 75 virtual bool IsShrinking() const; |
76 | 76 |
77 // Returns the amount of horizontal space needed to draw the image and its | |
78 // padding before the label. | |
79 virtual int GetImageAndPaddingWidth() const; | |
80 | |
81 // views::View: | 77 // views::View: |
82 gfx::Size GetPreferredSize() const override; | 78 gfx::Size GetPreferredSize() const override; |
83 void Layout() override; | 79 void Layout() override; |
84 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 80 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
85 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 81 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
86 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 82 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
87 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override; | 83 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override; |
88 SkColor GetInkDropBaseColor() const override; | 84 SkColor GetInkDropBaseColor() const override; |
89 | 85 |
90 const gfx::FontList& font_list() const { return label_->font_list(); } | 86 const gfx::FontList& font_list() const { return label_->font_list(); } |
(...skipping 19 matching lines...) Expand all Loading... |
110 const char* GetClassName() const override; | 106 const char* GetClassName() const override; |
111 void OnPaint(gfx::Canvas* canvas) override; | 107 void OnPaint(gfx::Canvas* canvas) override; |
112 | 108 |
113 // For painting the background. TODO(estade): remove post MD launch. | 109 // For painting the background. TODO(estade): remove post MD launch. |
114 scoped_ptr<views::Painter> background_painter_; | 110 scoped_ptr<views::Painter> background_painter_; |
115 | 111 |
116 // The contents of the bubble. | 112 // The contents of the bubble. |
117 views::ImageView* image_; | 113 views::ImageView* image_; |
118 views::Label* label_; | 114 views::Label* label_; |
119 | 115 |
| 116 // How much horizontal padding (fully-transparent columns) is inside the |
| 117 // image. These are subtracted from the desired padding values when |
| 118 // calculating the padding around the image, so that the image always appears |
| 119 // to have the same visible padding no matter what its composition is. Only |
| 120 // used in MD. |
| 121 int builtin_leading_padding_; |
| 122 int builtin_trailing_padding_; |
| 123 |
120 bool is_extension_icon_; | 124 bool is_extension_icon_; |
121 | 125 |
122 // This is only used in pre-MD. In MD, the background color is derived from | 126 // This is only used in pre-MD. In MD, the background color is derived from |
123 // the native theme (so it responds to native theme updates). TODO(estade): | 127 // the native theme (so it responds to native theme updates). TODO(estade): |
124 // remove when MD is default. | 128 // remove when MD is default. |
125 SkColor parent_background_color_; | 129 SkColor parent_background_color_; |
126 | 130 |
127 bool should_show_background_; | 131 bool should_show_background_; |
128 | 132 |
129 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); | 133 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); |
130 }; | 134 }; |
131 | 135 |
132 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 136 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
OLD | NEW |