| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 8 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 11 #include "views/controls/image_view.h" | 12 #include "views/controls/image_view.h" |
| 12 #include "views/controls/label.h" | 13 #include "views/controls/label.h" |
| 13 | 14 |
| 14 // Amount of padding at the edges of the bubble. | 15 // Amount of padding at the edges of the bubble. |
| 15 static const int kBubbleOuterPadding = LocationBarView::kEdgeItemPadding - | 16 static const int kBubbleOuterPadding = LocationBarView::kEdgeItemPadding - |
| 16 LocationBarView::kBubbleHorizontalPadding; | 17 LocationBarView::kBubbleHorizontalPadding; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 label_->SetColor(color); | 33 label_->SetColor(color); |
| 33 } | 34 } |
| 34 | 35 |
| 35 IconLabelBubbleView::~IconLabelBubbleView() { | 36 IconLabelBubbleView::~IconLabelBubbleView() { |
| 36 } | 37 } |
| 37 | 38 |
| 38 void IconLabelBubbleView::SetFont(const gfx::Font& font) { | 39 void IconLabelBubbleView::SetFont(const gfx::Font& font) { |
| 39 label_->SetFont(font); | 40 label_->SetFont(font); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void IconLabelBubbleView::SetLabel(const std::wstring& label) { | 43 void IconLabelBubbleView::SetLabel(const string16& label) { |
| 43 label_->SetText(label); | 44 label_->SetText(label); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void IconLabelBubbleView::SetImage(const SkBitmap& bitmap) { | 47 void IconLabelBubbleView::SetImage(const SkBitmap& bitmap) { |
| 47 image_->SetImage(bitmap); | 48 image_->SetImage(bitmap); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { | 51 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { |
| 51 background_painter_.Paint(width(), height(), canvas); | 52 background_painter_.Paint(width(), height(), canvas); |
| 52 } | 53 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 | 77 |
| 77 int IconLabelBubbleView::GetPreLabelWidth() const { | 78 int IconLabelBubbleView::GetPreLabelWidth() const { |
| 78 return kBubbleOuterPadding + ResourceBundle::GetSharedInstance(). | 79 return kBubbleOuterPadding + ResourceBundle::GetSharedInstance(). |
| 79 GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() + | 80 GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() + |
| 80 LocationBarView::kItemPadding; | 81 LocationBarView::kItemPadding; |
| 81 } | 82 } |
| 82 | 83 |
| 83 int IconLabelBubbleView::GetNonLabelWidth() const { | 84 int IconLabelBubbleView::GetNonLabelWidth() const { |
| 84 return GetPreLabelWidth() + kBubbleOuterPadding; | 85 return GetPreLabelWidth() + kBubbleOuterPadding; |
| 85 } | 86 } |
| OLD | NEW |