| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 private: | 105 private: |
| 106 // Sets a background color on |label_| based on |chip_background_color| and | 106 // Sets a background color on |label_| based on |chip_background_color| and |
| 107 // the parent's bg color. | 107 // the parent's bg color. |
| 108 void SetLabelBackgroundColor(SkColor chip_background_color); | 108 void SetLabelBackgroundColor(SkColor chip_background_color); |
| 109 | 109 |
| 110 // Amount of padding from the leading edge of the view to the leading edge of | 110 // Amount of padding from the leading edge of the view to the leading edge of |
| 111 // the image (if |leading| is true), or from the trailing edge of the label | 111 // the image (if |leading| is true), or from the trailing edge of the label |
| 112 // (or image, if the label is invisible) to the trailing edge of the view. | 112 // (or image, if the label is invisible) to the trailing edge of the view. |
| 113 int GetOuterPadding(bool leading) const; | 113 int GetOuterPadding(bool leading) const; |
| 114 | 114 |
| 115 // Horizontal position of the image trailing edge (i.e. just after the image). |
| 116 int GetImageTrailingEdge() const; |
| 117 |
| 115 // Spacing between the image and the label. | 118 // Spacing between the image and the label. |
| 116 int GetInternalSpacing() const; | 119 int GetInternalSpacing() const; |
| 117 | 120 |
| 121 // Additional width necessary after the label, when the view is at full width. |
| 122 int GetPostLabelWidth() const; |
| 123 |
| 118 // views::View: | 124 // views::View: |
| 119 const char* GetClassName() const override; | 125 const char* GetClassName() const override; |
| 120 void OnPaint(gfx::Canvas* canvas) override; | 126 void OnPaint(gfx::Canvas* canvas) override; |
| 121 | 127 |
| 122 // For painting the background. TODO(estade): remove post MD launch. | 128 // For painting the background. TODO(estade): remove post MD launch. |
| 123 std::unique_ptr<views::Painter> background_painter_; | 129 std::unique_ptr<views::Painter> background_painter_; |
| 124 | 130 |
| 125 // The contents of the bubble. | 131 // The contents of the bubble. |
| 126 views::ImageView* image_; | 132 views::ImageView* image_; |
| 127 views::Label* label_; | 133 views::Label* label_; |
| 128 | 134 |
| 129 bool is_extension_icon_; | 135 bool is_extension_icon_; |
| 130 | 136 |
| 131 // This is only used in pre-MD. In MD, the background color is derived from | 137 // This is only used in pre-MD. In MD, the background color is derived from |
| 132 // the native theme (so it responds to native theme updates). TODO(estade): | 138 // the native theme (so it responds to native theme updates). TODO(estade): |
| 133 // remove when MD is default. | 139 // remove when MD is default. |
| 134 SkColor parent_background_color_; | 140 SkColor parent_background_color_; |
| 135 | 141 |
| 136 bool should_show_background_; | 142 bool should_show_background_; |
| 137 | 143 |
| 138 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); | 144 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); |
| 139 }; | 145 }; |
| 140 | 146 |
| 141 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 147 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| OLD | NEW |