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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_decoration_view.cc

Issue 10917280: Fix up views web intents location bar decoration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add period Created 8 years, 3 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/location_bar_decoration_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_decoration_view.cc b/chrome/browser/ui/views/location_bar/location_bar_decoration_view.cc
index 8b214e24084ee23279c1f960a4a3ef9e6ccae187..c7d04cc30fdd476634fd182cb462c028e9e5ea6d 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_decoration_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_decoration_view.cc
@@ -12,7 +12,6 @@
#include "third_party/skia/include/core/SkShader.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/base/animation/tween.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/border.h"
@@ -22,15 +21,18 @@ namespace {
// Animation parameters.
const int kFrameRateHz = 60;
// Margins for animated box (pixels).
-const int kTextMargin = 4;
+const int kTextMargin = 5;
const int kIconLeftMargin = 4;
-
}
LocationBarDecorationView::LocationBarDecorationView(
LocationBarView* parent,
- const int background_images[])
+ const int background_images[],
+ const gfx::Font& font,
+ SkColor font_color)
: parent_(parent),
+ font_(font),
+ font_color_(font_color),
pause_animation_(false),
pause_animation_state_(0.0),
text_size_(0),
@@ -106,8 +108,7 @@ void LocationBarDecorationView::StartLabelAnimation(string16 animated_text,
// Initialize animated string. It will be cleared when animation is
// completed.
animated_text_ = animated_text;
- text_size_ = ui::ResourceBundle::GetSharedInstance().GetFont(
- ui::ResourceBundle::MediumFont).GetStringWidth(animated_text);
+ text_size_ = font_.GetStringWidth(animated_text);
text_size_ += 2 * kTextMargin + kIconLeftMargin;
slide_animator_->Show();
}
@@ -171,9 +172,7 @@ void LocationBarDecorationView::OnPaint(gfx::Canvas* canvas) {
views::ImageView::OnPaint(canvas);
// Paint text to the right of the icon.
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- canvas->DrawStringInt(animated_text_,
- rb.GetFont(ui::ResourceBundle::MediumFont), SK_ColorBLACK,
+ canvas->DrawStringInt(animated_text_, font_, font_color_,
GetImageBounds().right() + kTextMargin, 0,
width() - GetImageBounds().width(), height(),
gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::TEXT_VALIGN_MIDDLE);

Powered by Google App Engine
This is Rietveld 408576698