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/chromeos/login/username_view.h" | 5 #include "chrome/browser/chromeos/login/username_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/login/rounded_view.h" | 9 #include "chrome/browser/chromeos/login/rounded_view.h" |
10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 gfx::Size(text_image_->width(), text_image_->height())); | 90 gfx::Size(text_image_->width(), text_image_->height())); |
91 canvas->DrawBitmapInt(*text_image_, bounds.x(), bounds.y()); | 91 canvas->DrawBitmapInt(*text_image_, bounds.x(), bounds.y()); |
92 } | 92 } |
93 | 93 |
94 // static | 94 // static |
95 UsernameView* UsernameView::CreateShapedUsernameView( | 95 UsernameView* UsernameView::CreateShapedUsernameView( |
96 const std::wstring& username, bool use_small_shape) { | 96 const std::wstring& username, bool use_small_shape) { |
97 return new HalfRoundedView<UsernameView>(username, use_small_shape); | 97 return new HalfRoundedView<UsernameView>(username, use_small_shape); |
98 } | 98 } |
99 | 99 |
100 gfx::NativeCursor UsernameView::GetCursorForPoint( | 100 gfx::NativeCursor UsernameView::GetCursorForPoint(ui::EventType event_type, |
101 ui::EventType event_type, | 101 const gfx::Point& p) { |
102 const gfx::Point& p) { | |
103 return use_small_shape_ ? gfx::GetCursor(GDK_HAND2) : NULL; | 102 return use_small_shape_ ? gfx::GetCursor(GDK_HAND2) : NULL; |
104 } | 103 } |
105 | 104 |
106 void UsernameView::PaintUsername(const gfx::Rect& bounds) { | 105 void UsernameView::PaintUsername(const gfx::Rect& bounds) { |
107 margin_width_ = bounds.height() * kMarginRatio; | 106 margin_width_ = bounds.height() * kMarginRatio; |
108 gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false); | 107 gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false); |
109 // Draw transparent background. | 108 // Draw transparent background. |
110 canvas.drawColor(0); | 109 canvas.drawColor(0); |
111 | 110 |
112 // Calculate needed space. | 111 // Calculate needed space. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void UsernameView::OnLocaleChanged() { | 188 void UsernameView::OnLocaleChanged() { |
190 if (is_guest_) { | 189 if (is_guest_) { |
191 SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST))); | 190 SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST))); |
192 } | 191 } |
193 // Repaint because the font may have changed. | 192 // Repaint because the font may have changed. |
194 text_image_.reset(); | 193 text_image_.reset(); |
195 SchedulePaint(); | 194 SchedulePaint(); |
196 } | 195 } |
197 | 196 |
198 } // namespace chromeos | 197 } // namespace chromeos |
OLD | NEW |