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

Unified Diff: ash/shell/lock_view.cc

Issue 149383002: Clean-up: Replace Canvas::DrawStringInt with DrawStringRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed the build break. Created 6 years, 11 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
« no previous file with comments | « ash/shell/app_list.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell/lock_view.cc
diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc
index a9ccd7b8850e472c3ab415ce4350ad186cb40174..5d17d8dd486a58bffc30a8da3f8d1fbc4753c638 100644
--- a/ash/shell/lock_view.cc
+++ b/ash/shell/lock_view.cc
@@ -4,13 +4,15 @@
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
-#include "ash/shell_window_ids.h"
#include "ash/shell/example_factory.h"
+#include "ash/shell_window_ids.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/text_utils.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/corewm/tooltip_controller.h"
#include "ui/views/widget/widget.h"
@@ -42,10 +44,11 @@ class LockView : public views::WidgetDelegateView,
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
base::string16 text = base::ASCIIToUTF16("LOCKED!");
- int string_width = font_.GetStringWidth(text);
- canvas->DrawStringInt(text, font_, SK_ColorRED, (width() - string_width)/ 2,
- (height() - font_.GetHeight()) / 2,
- string_width, font_.GetHeight());
+ int string_width = gfx::GetStringWidth(text, font_list_);
+ canvas->DrawStringRect(text, font_list_, SK_ColorRED,
+ gfx::Rect((width() - string_width)/ 2,
+ (height() - font_list_.GetHeight()) / 2,
+ string_width, font_list_.GetHeight()));
}
virtual void Layout() OVERRIDE {
gfx::Rect bounds = GetLocalBounds();
@@ -73,7 +76,7 @@ class LockView : public views::WidgetDelegateView,
GetWidget()->Close();
}
- gfx::Font font_;
+ gfx::FontList font_list_;
views::LabelButton* unlock_button_;
DISALLOW_COPY_AND_ASSIGN(LockView);
« no previous file with comments | « ash/shell/app_list.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698