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