Chromium Code Reviews| 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/string16.h" | 10 #include "base/string16.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 #include "ui/views/painter.h" | 12 #include "ui/views/painter.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Canvas; | 16 class Canvas; |
| 17 class Font; | 17 class Font; |
| 18 class ImageSkia; | 18 class ImageSkia; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class ImageView; | 22 class ImageView; |
| 23 class Label; | 23 class Label; |
| 24 } | 24 } |
| 25 | 25 |
| 26 // View used to draw a bubble to the left of the address, containing an icon and | 26 // View used to draw a bubble to the: |
| 27 // a label. We use this as a base for the classes that handle the EV bubble and | 27 // - left of the address, containing an icon and a label. We use this |
| 28 // tab-to-search UI. | 28 // as a base for the classes that handle the EV bubble and tab-to-search UI. |
| 29 // - right of the omnibox (left of all icons on the right of the omnibox), | |
| 30 // containing just the label. We use this for the search bubble when omnibox | |
| 31 // replaces the URL with its query terms. | |
|
Peter Kasting
2012/12/05 21:13:20
Nit: Instead of being so detailed here about the u
kuan
2012/12/11 21:10:29
Done.
| |
| 29 class IconLabelBubbleView : public views::View { | 32 class IconLabelBubbleView : public views::View { |
| 30 public: | 33 public: |
| 34 // Set |contained_image| to -1 if there's no icon. | |
|
beaudoin
2012/12/04 15:20:09
I think in this case it would be OK/cleaner to hav
Peter Kasting
2012/12/05 21:13:20
Because the two constructors' implementations woul
| |
| 31 IconLabelBubbleView(const int background_images[], | 35 IconLabelBubbleView(const int background_images[], |
| 32 int contained_image, | 36 int contained_image, |
| 33 SkColor color); | 37 SkColor color); |
| 34 virtual ~IconLabelBubbleView(); | 38 virtual ~IconLabelBubbleView(); |
| 35 | 39 |
| 36 void SetFont(const gfx::Font& font); | 40 void SetFont(const gfx::Font& font); |
| 37 void SetLabel(const string16& label); | 41 void SetLabel(const string16& label); |
| 38 void SetImage(const gfx::ImageSkia& image); | 42 void SetImage(const gfx::ImageSkia& image); |
|
beaudoin
2012/12/04 15:20:09
Should maybe add a ClearImage(); to go full-circle
Peter Kasting
2012/12/05 21:13:20
I wouldn't do this if we don't need it; I'm not a
| |
| 39 void set_is_extension_icon(bool is_extension_icon) { | 43 void set_is_extension_icon(bool is_extension_icon) { |
| 40 is_extension_icon_ = is_extension_icon; | 44 is_extension_icon_ = is_extension_icon; |
| 41 } | 45 } |
| 42 | 46 |
| 43 // Sets the label's text background color to |color|. Needed for correct | 47 // Sets the label's text background color to |color|. Needed for correct |
| 44 // sub-pixel text rendering. | 48 // sub-pixel text rendering. |
| 45 void SetLabelBackgroundColor(SkColor color); | 49 void SetLabelBackgroundColor(SkColor color); |
| 46 | 50 |
| 47 // views::View overrides: | 51 // views::View overrides: |
| 48 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 52 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 63 // The contents of the bubble. | 67 // The contents of the bubble. |
| 64 views::ImageView* image_; | 68 views::ImageView* image_; |
| 65 views::Label* label_; | 69 views::Label* label_; |
| 66 | 70 |
| 67 bool is_extension_icon_; | 71 bool is_extension_icon_; |
| 68 | 72 |
| 69 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView); |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ |
| OLD | NEW |