| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 // views::View: | 49 // views::View: |
| 50 virtual gfx::Size GetPreferredSize() OVERRIDE; | 50 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 51 virtual void Layout() OVERRIDE; | 51 virtual void Layout() OVERRIDE; |
| 52 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 52 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 53 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 53 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 54 | 54 |
| 55 gfx::Size GetSizeForLabelWidth(int width) const; | 55 gfx::Size GetSizeForLabelWidth(int width) const; |
| 56 gfx::Size GetSizeForLabelText(const base::string16& text) const; |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 // Amount of padding at the edges of the bubble. If |by_icon| is true, this | 59 // Amount of padding at the edges of the bubble. If |by_icon| is true, this |
| 59 // is the padding next to the icon; otherwise it's the padding next to the | 60 // is the padding next to the icon; otherwise it's the padding next to the |
| 60 // label. (We increase padding next to the label by the amount of padding | 61 // label. (We increase padding next to the label by the amount of padding |
| 61 // "built in" to the icon in order to make the bubble appear to have | 62 // "built in" to the icon in order to make the bubble appear to have |
| 62 // symmetrical padding.) | 63 // symmetrical padding.) |
| 63 static int GetBubbleOuterPadding(bool by_icon); | 64 static int GetBubbleOuterPadding(bool by_icon); |
| 64 | 65 |
| 65 // views::View: | 66 // views::View: |
| 66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 67 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 67 | 68 |
| 68 int GetPreLabelWidth() const; | 69 int GetPreLabelWidth() const; |
| 69 | 70 |
| 70 // For painting the background. | 71 // For painting the background. |
| 71 scoped_ptr<views::Painter> background_painter_; | 72 scoped_ptr<views::Painter> background_painter_; |
| 72 scoped_ptr<views::Painter> hover_background_painter_; | 73 scoped_ptr<views::Painter> hover_background_painter_; |
| 73 | 74 |
| 74 // The contents of the bubble. | 75 // The contents of the bubble. |
| 75 views::ImageView* image_; | 76 views::ImageView* image_; |
| 76 views::Label* label_; | 77 views::Label* label_; |
| 77 | 78 |
| 78 bool is_extension_icon_; | 79 bool is_extension_icon_; |
| 79 bool in_hover_; | 80 bool in_hover_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); | 82 DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 85 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| OLD | NEW |