| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // views::View: | 71 // views::View: |
| 72 gfx::Size GetPreferredSize() const override; | 72 gfx::Size GetPreferredSize() const override; |
| 73 void Layout() override; | 73 void Layout() override; |
| 74 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 74 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 75 | 75 |
| 76 const gfx::FontList& font_list() const { return label_->font_list(); } | 76 const gfx::FontList& font_list() const { return label_->font_list(); } |
| 77 | 77 |
| 78 gfx::Size GetSizeForLabelWidth(int width) const; | 78 gfx::Size GetSizeForLabelWidth(int width) const; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // Amount of padding at the edges of the bubble. If |start| is true, this | 81 // Amount of padding at the edges of the bubble. If |leading| is true, this |
| 82 // is the padding at the beginning of the bubble (left in LTR), otherwise it's | 82 // is the padding at the beginning of the bubble (left in LTR), otherwise it's |
| 83 // the end padding. | 83 // the end padding. |
| 84 int GetBubbleOuterPadding(bool start) const; | 84 int GetBubbleOuterPadding(bool leading) const; |
| 85 |
| 86 // As above, but for Material Design. TODO(estade): remove/replace the above. |
| 87 int GetBubbleOuterPaddingMd(bool leading) const; |
| 85 | 88 |
| 86 // Sets a background color on |label_| based on |background_image_color| and | 89 // Sets a background color on |label_| based on |background_image_color| and |
| 87 // |parent_background_color_|. | 90 // |parent_background_color_|. |
| 88 void SetLabelBackgroundColor(SkColor background_image_color); | 91 void SetLabelBackgroundColor(SkColor background_image_color); |
| 89 | 92 |
| 90 // views::View: | 93 // views::View: |
| 91 const char* GetClassName() const override; | 94 const char* GetClassName() const override; |
| 92 void OnPaint(gfx::Canvas* canvas) override; | 95 void OnPaint(gfx::Canvas* canvas) override; |
| 93 | 96 |
| 94 // For painting the background. TODO(estade): remove post MD launch. | 97 // For painting the background. TODO(estade): remove post MD launch. |
| 95 scoped_ptr<views::Painter> background_painter_; | 98 scoped_ptr<views::Painter> background_painter_; |
| 96 | 99 |
| 97 // The contents of the bubble. | 100 // The contents of the bubble. |
| 98 views::ImageView* image_; | 101 views::ImageView* image_; |
| 99 views::Label* label_; | 102 views::Label* label_; |
| 100 | 103 |
| 101 bool is_extension_icon_; | 104 bool is_extension_icon_; |
| 102 | 105 |
| 103 SkColor parent_background_color_; | 106 SkColor parent_background_color_; |
| 104 | 107 |
| 105 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); | 108 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 111 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| OLD | NEW |