Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.h

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 #include "ui/views/painter.h" 13 #include "ui/views/painter.h"
14 #include "ui/views/view.h" 14 #include "ui/views/view.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class Canvas; 17 class CanvasSkia;
18 class Font; 18 class Font;
19 } 19 }
20 namespace views { 20 namespace views {
21 class ImageView; 21 class ImageView;
22 class Label; 22 class Label;
23 } 23 }
24 24
25 class SkBitmap; 25 class SkBitmap;
26 26
27 // View used to draw a bubble to the left of the address, containing an icon and 27 // View used to draw a bubble to the left of the address, containing an icon and
28 // a label. We use this as a base for the classes that handle the EV bubble and 28 // a label. We use this as a base for the classes that handle the EV bubble and
29 // tab-to-search UI. 29 // tab-to-search UI.
30 class IconLabelBubbleView : public views::View { 30 class IconLabelBubbleView : public views::View {
31 public: 31 public:
32 IconLabelBubbleView(const int background_images[], 32 IconLabelBubbleView(const int background_images[],
33 int contained_image, 33 int contained_image,
34 const SkColor& color); 34 const SkColor& color);
35 virtual ~IconLabelBubbleView(); 35 virtual ~IconLabelBubbleView();
36 36
37 void SetFont(const gfx::Font& font); 37 void SetFont(const gfx::Font& font);
38 void SetLabel(const string16& label); 38 void SetLabel(const string16& label);
39 void SetImage(const SkBitmap& bitmap); 39 void SetImage(const SkBitmap& bitmap);
40 void set_is_extension_icon(bool is_extension_icon) { 40 void set_is_extension_icon(bool is_extension_icon) {
41 is_extension_icon_ = is_extension_icon; 41 is_extension_icon_ = is_extension_icon;
42 } 42 }
43 43
44 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 44 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE;
45 virtual gfx::Size GetPreferredSize() OVERRIDE; 45 virtual gfx::Size GetPreferredSize() OVERRIDE;
46 virtual void Layout() OVERRIDE; 46 virtual void Layout() OVERRIDE;
47 47
48 protected: 48 protected:
49 void SetElideInMiddle(bool elide_in_middle); 49 void SetElideInMiddle(bool elide_in_middle);
50 gfx::Size GetNonLabelSize() const; 50 gfx::Size GetNonLabelSize() const;
51 51
52 private: 52 private:
53 int GetPreLabelWidth() const; 53 int GetPreLabelWidth() const;
54 int GetNonLabelWidth() const; 54 int GetNonLabelWidth() const;
55 55
56 // For painting the background. 56 // For painting the background.
57 views::HorizontalPainter background_painter_; 57 views::HorizontalPainter background_painter_;
58 58
59 // The contents of the bubble. 59 // The contents of the bubble.
60 views::ImageView* image_; 60 views::ImageView* image_;
61 views::Label* label_; 61 views::Label* label_;
62 62
63 bool is_extension_icon_; 63 bool is_extension_icon_;
64 64
65 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView); 65 DISALLOW_IMPLICIT_CONSTRUCTORS(IconLabelBubbleView);
66 }; 66 };
67 67
68 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_ 68 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698