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

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

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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) 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 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void IconLabelBubbleView::SetFont(const gfx::Font& font) { 53 void IconLabelBubbleView::SetFont(const gfx::Font& font) {
54 label_->SetFont(font); 54 label_->SetFont(font);
55 } 55 }
56 56
57 void IconLabelBubbleView::SetLabel(const string16& label) { 57 void IconLabelBubbleView::SetLabel(const string16& label) {
58 label_->SetText(label); 58 label_->SetText(label);
59 } 59 }
60 60
61 void IconLabelBubbleView::SetImage(const SkBitmap& bitmap) { 61 void IconLabelBubbleView::SetImage(const gfx::ImageSkia& image_skia) {
62 image_->SetImage(bitmap); 62 image_->SetImage(image_skia);
63 } 63 }
64 64
65 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { 65 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) {
66 background_painter_.Paint(canvas, size()); 66 background_painter_.Paint(canvas, size());
67 } 67 }
68 68
69 gfx::Size IconLabelBubbleView::GetPreferredSize() { 69 gfx::Size IconLabelBubbleView::GetPreferredSize() {
70 gfx::Size size(GetNonLabelSize()); 70 gfx::Size size(GetNonLabelSize());
71 size.Enlarge(label_->GetPreferredSize().width(), 0); 71 size.Enlarge(label_->GetPreferredSize().width(), 0);
72 return size; 72 return size;
(...skipping 12 matching lines...) Expand all
85 label_->SetElideInMiddle(elide_in_middle); 85 label_->SetElideInMiddle(elide_in_middle);
86 } 86 }
87 87
88 gfx::Size IconLabelBubbleView::GetNonLabelSize() const { 88 gfx::Size IconLabelBubbleView::GetNonLabelSize() const {
89 return gfx::Size(GetNonLabelWidth(), background_painter_.height()); 89 return gfx::Size(GetNonLabelWidth(), background_painter_.height());
90 } 90 }
91 91
92 int IconLabelBubbleView::GetPreLabelWidth() const { 92 int IconLabelBubbleView::GetPreLabelWidth() const {
93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
94 return GetBubbleOuterPadding() + 94 return GetBubbleOuterPadding() +
95 rb.GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() + 95 rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)->width() +
96 LocationBarView::GetItemPadding(); 96 LocationBarView::GetItemPadding();
97 } 97 }
98 98
99 int IconLabelBubbleView::GetNonLabelWidth() const { 99 int IconLabelBubbleView::GetNonLabelWidth() const {
100 return GetPreLabelWidth() + GetBubbleOuterPadding(); 100 return GetPreLabelWidth() + GetBubbleOuterPadding();
101 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698