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

Unified Diff: chrome/browser/ui/views/location_bar/keyword_hint_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/keyword_hint_view.cc
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
index d514f94b55ba6a7c0268501e11d319a6aee3844e..686cc62a42f4af8f93a4dc2e280fca6c108948f6 100644
--- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
@@ -15,25 +15,25 @@
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/label.h"
// Amount of space to offset the tab image from the top of the view by.
static const int kTabImageYOffset = 4;
// The tab key image.
-static const SkBitmap* kTabButtonBitmap = NULL;
+static const gfx::ImageSkia* kTabButtonImage = NULL;
KeywordHintView::KeywordHintView(Profile* profile) : profile_(profile) {
leading_label_ = CreateLabel();
trailing_label_ = CreateLabel();
- if (!kTabButtonBitmap) {
+ if (!kTabButtonImage) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- kTabButtonBitmap = rb.GetBitmapNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB);
+ kTabButtonImage = rb.GetImageSkiaNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB);
}
}
@@ -85,10 +85,10 @@ void KeywordHintView::OnPaint(gfx::Canvas* canvas) {
// is right-to-left.
gfx::Rect tab_button_bounds(image_x,
kTabImageYOffset,
- kTabButtonBitmap->width(),
- kTabButtonBitmap->height());
+ kTabButtonImage->width(),
+ kTabButtonImage->height());
tab_button_bounds.set_x(GetMirroredXForRect(tab_button_bounds));
- canvas->DrawBitmapInt(*kTabButtonBitmap,
+ canvas->DrawBitmapInt(*kTabButtonImage,
tab_button_bounds.x(),
tab_button_bounds.y());
}
@@ -98,7 +98,7 @@ gfx::Size KeywordHintView::GetPreferredSize() {
// added this should check baselines.
gfx::Size prefsize = leading_label_->GetPreferredSize();
int width = prefsize.width();
- width += kTabButtonBitmap->width();
+ width += kTabButtonImage->width();
prefsize = trailing_label_->GetPreferredSize();
width += prefsize.width();
return gfx::Size(width, prefsize.height());
@@ -107,12 +107,12 @@ gfx::Size KeywordHintView::GetPreferredSize() {
gfx::Size KeywordHintView::GetMinimumSize() {
// TODO(sky): currently height doesn't matter, once baseline support is
// added this should check baselines.
- return gfx::Size(kTabButtonBitmap->width(), 0);
+ return gfx::Size(kTabButtonImage->width(), 0);
}
void KeywordHintView::Layout() {
// TODO(sky): baseline layout.
- bool show_labels = (width() != kTabButtonBitmap->width());
+ bool show_labels = (width() != kTabButtonImage->width());
leading_label_->SetVisible(show_labels);
trailing_label_->SetVisible(show_labels);
@@ -123,7 +123,7 @@ void KeywordHintView::Layout() {
pref = leading_label_->GetPreferredSize();
leading_label_->SetBounds(x, 0, pref.width(), height());
- x += pref.width() + kTabButtonBitmap->width();
+ x += pref.width() + kTabButtonImage->width();
pref = trailing_label_->GetPreferredSize();
trailing_label_->SetBounds(x, 0, pref.width(), height());
}

Powered by Google App Engine
This is Rietveld 408576698