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

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

Issue 2973006: Use the extension icon for extension omnibox results instead of the generic (Closed)
Patch Set: fixed mac Created 10 years, 5 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
OLDNEW
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 #include "chrome/browser/views/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "chrome/browser/views/location_bar/location_bar_view.h" 8 #include "chrome/browser/views/location_bar/location_bar_view.h"
9 #include "gfx/canvas.h" 9 #include "gfx/canvas.h"
10 #include "views/controls/image_view.h" 10 #include "views/controls/image_view.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 void IconLabelBubbleView::SetFont(const gfx::Font& font) { 38 void IconLabelBubbleView::SetFont(const gfx::Font& font) {
39 label_->SetFont(font); 39 label_->SetFont(font);
40 } 40 }
41 41
42 void IconLabelBubbleView::SetLabel(const std::wstring& label) { 42 void IconLabelBubbleView::SetLabel(const std::wstring& label) {
43 label_->SetText(label); 43 label_->SetText(label);
44 } 44 }
45 45
46 void IconLabelBubbleView::SetImage(const SkBitmap& bitmap) {
47 image_->SetImage(bitmap);
48 }
49
46 void IconLabelBubbleView::Paint(gfx::Canvas* canvas) { 50 void IconLabelBubbleView::Paint(gfx::Canvas* canvas) {
47 int y_offset = (GetParent()->height() - height()) / 2; 51 int y_offset = (GetParent()->height() - height()) / 2;
48 canvas->TranslateInt(0, y_offset); 52 canvas->TranslateInt(0, y_offset);
49 background_painter_.Paint(width(), height(), canvas); 53 background_painter_.Paint(width(), height(), canvas);
50 canvas->TranslateInt(0, -y_offset); 54 canvas->TranslateInt(0, -y_offset);
51 } 55 }
52 56
53 gfx::Size IconLabelBubbleView::GetPreferredSize() { 57 gfx::Size IconLabelBubbleView::GetPreferredSize() {
54 gfx::Size size(GetNonLabelSize()); 58 gfx::Size size(GetNonLabelSize());
55 size.Enlarge(label_->GetPreferredSize().width(), 0); 59 size.Enlarge(label_->GetPreferredSize().width(), 0);
(...skipping 14 matching lines...) Expand all
70 } 74 }
71 75
72 gfx::Size IconLabelBubbleView::GetNonLabelSize() { 76 gfx::Size IconLabelBubbleView::GetNonLabelSize() {
73 return gfx::Size(GetNonLabelWidth(), background_painter_.height()); 77 return gfx::Size(GetNonLabelWidth(), background_painter_.height());
74 } 78 }
75 79
76 int IconLabelBubbleView::GetNonLabelWidth() { 80 int IconLabelBubbleView::GetNonLabelWidth() {
77 return kImageOffset + image_->GetPreferredSize().width() + kLabelOffset + 81 return kImageOffset + image_->GetPreferredSize().width() + kLabelOffset +
78 kLabelPadding; 82 kLabelPadding;
79 } 83 }
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar/icon_label_bubble_view.h ('k') | chrome/browser/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698