| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 86 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 87 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override; | 87 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override; |
| 88 SkColor GetInkDropBaseColor() const override; | 88 SkColor GetInkDropBaseColor() const override; |
| 89 | 89 |
| 90 const gfx::FontList& font_list() const { return label_->font_list(); } | 90 const gfx::FontList& font_list() const { return label_->font_list(); } |
| 91 | 91 |
| 92 SkColor GetParentBackgroundColor() const; | 92 SkColor GetParentBackgroundColor() const; |
| 93 | 93 |
| 94 gfx::Size GetSizeForLabelWidth(int label_width) const; | 94 gfx::Size GetSizeForLabelWidth(int label_width) const; |
| 95 | 95 |
| 96 // Amount of padding from the edge of the icon / label to the outer edge of | 96 // Returns the minimum width the view can be to show the complete image when |
| 97 // the bubble view. If |leading| is true, this is the padding at the | 97 // the background is showing. |
| 98 // beginning of the bubble (left in LTR), otherwise it's the trailing padding. | 98 int MinimumWidthForImageWithBackgroundShown() const; |
| 99 int GetBubbleOuterPadding(bool leading) const; | |
| 100 | 99 |
| 101 private: | 100 private: |
| 102 // Sets a background color on |label_| based on |chip_background_color| and | 101 // Sets a background color on |label_| based on |chip_background_color| and |
| 103 // the parent's bg color. | 102 // the parent's bg color. |
| 104 void SetLabelBackgroundColor(SkColor chip_background_color); | 103 void SetLabelBackgroundColor(SkColor chip_background_color); |
| 105 | 104 |
| 106 // As above, but for Material Design. TODO(estade): remove/replace the above. | 105 // Amount of padding from the leading edge of the view to the leading edge of |
| 107 int GetBubbleOuterPaddingMd(bool leading) const; | 106 // the image (if |leading| is true), or from the trailing edge of the label |
| 107 // (or image, if the label is invisible) to the trailing edge of the view. |
| 108 int GetOuterPadding(bool leading) const; |
| 109 |
| 110 // Spacing between the image and the label. |
| 111 int GetInternalSpacing() const; |
| 108 | 112 |
| 109 // views::View: | 113 // views::View: |
| 110 const char* GetClassName() const override; | 114 const char* GetClassName() const override; |
| 111 void OnPaint(gfx::Canvas* canvas) override; | 115 void OnPaint(gfx::Canvas* canvas) override; |
| 112 | 116 |
| 113 // For painting the background. TODO(estade): remove post MD launch. | 117 // For painting the background. TODO(estade): remove post MD launch. |
| 114 scoped_ptr<views::Painter> background_painter_; | 118 scoped_ptr<views::Painter> background_painter_; |
| 115 | 119 |
| 116 // The contents of the bubble. | 120 // The contents of the bubble. |
| 117 views::ImageView* image_; | 121 views::ImageView* image_; |
| 118 views::Label* label_; | 122 views::Label* label_; |
| 119 | 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 |