| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "gfx/size.h" | 10 #include "gfx/size.h" |
| 11 #include "views/painter.h" | 11 #include "views/painter.h" |
| 12 #include "views/view.h" | 12 #include "views/view.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Canvas; | 15 class Canvas; |
| 16 class Font; | 16 class Font; |
| 17 } | 17 } |
| 18 namespace views { | 18 namespace views { |
| 19 class ImageView; | 19 class ImageView; |
| 20 class Label; | 20 class Label; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class SkBitmap; |
| 24 |
| 23 // View used to draw a bubble to the left of the address, containing an icon and | 25 // View used to draw a bubble to the left of the address, containing an icon and |
| 24 // a label. We use this as a base for the classes that handle the EV bubble and | 26 // a label. We use this as a base for the classes that handle the EV bubble and |
| 25 // tab-to-search UI. | 27 // tab-to-search UI. |
| 26 class IconLabelBubbleView : public views::View { | 28 class IconLabelBubbleView : public views::View { |
| 27 public: | 29 public: |
| 28 IconLabelBubbleView(const int background_images[], | 30 IconLabelBubbleView(const int background_images[], |
| 29 int contained_image, | 31 int contained_image, |
| 30 const SkColor& color); | 32 const SkColor& color); |
| 31 virtual ~IconLabelBubbleView(); | 33 virtual ~IconLabelBubbleView(); |
| 32 | 34 |
| 33 void SetFont(const gfx::Font& font); | 35 void SetFont(const gfx::Font& font); |
| 34 void SetLabel(const std::wstring& label); | 36 void SetLabel(const std::wstring& label); |
| 37 void SetImage(const SkBitmap& bitmap); |
| 35 | 38 |
| 36 virtual void Paint(gfx::Canvas* canvas); | 39 virtual void Paint(gfx::Canvas* canvas); |
| 37 virtual gfx::Size GetPreferredSize(); | 40 virtual gfx::Size GetPreferredSize(); |
| 38 virtual void Layout(); | 41 virtual void Layout(); |
| 39 | 42 |
| 40 protected: | 43 protected: |
| 41 void SetElideInMiddle(bool elide_in_middle); | 44 void SetElideInMiddle(bool elide_in_middle); |
| 42 gfx::Size GetNonLabelSize(); | 45 gfx::Size GetNonLabelSize(); |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 int GetNonLabelWidth(); | 48 int GetNonLabelWidth(); |
| 46 | 49 |
| 47 // For painting the background. | 50 // For painting the background. |
| 48 views::HorizontalPainter background_painter_; | 51 views::HorizontalPainter background_painter_; |
| 49 | 52 |
| 50 // The contents of the bubble. | 53 // The contents of the bubble. |
| 51 views::ImageView* image_; | 54 views::ImageView* image_; |
| 52 views::Label* label_; | 55 views::Label* label_; |
| 53 | 56 |
| 54 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView); | 57 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 60 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| OLD | NEW |