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

Side by Side Diff: chrome/browser/chromeos/login/username_view.cc

Issue 6462022: It turns out I had the sense of the GetLocalBounds bool wrong everywhere, so ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } // namespace 74 } // namespace
75 75
76 UsernameView::UsernameView(const std::wstring& username, bool use_small_shape) 76 UsernameView::UsernameView(const std::wstring& username, bool use_small_shape)
77 : views::Label(username.empty() 77 : views::Label(username.empty()
78 ? UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST)) : username), 78 ? UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST)) : username),
79 use_small_shape_(use_small_shape), 79 use_small_shape_(use_small_shape),
80 is_guest_(username.empty()) { 80 is_guest_(username.empty()) {
81 } 81 }
82 82
83 void UsernameView::Paint(gfx::Canvas* canvas) { 83 void UsernameView::Paint(gfx::Canvas* canvas) {
84 gfx::Rect bounds = GetLocalBounds(); 84 gfx::Rect bounds = GetContentsBounds();
85 if (text_image_ == NULL) 85 if (text_image_ == NULL)
86 PaintUsername(bounds); 86 PaintUsername(bounds);
87 DCHECK(text_image_ != NULL); 87 DCHECK(text_image_ != NULL);
88 DCHECK(bounds.size() == 88 DCHECK(bounds.size() ==
89 gfx::Size(text_image_->width(), text_image_->height())); 89 gfx::Size(text_image_->width(), text_image_->height()));
90 canvas->DrawBitmapInt(*text_image_, bounds.x(), bounds.y()); 90 canvas->DrawBitmapInt(*text_image_, bounds.x(), bounds.y());
91 } 91 }
92 92
93 // static 93 // static
94 UsernameView* UsernameView::CreateShapedUsernameView( 94 UsernameView* UsernameView::CreateShapedUsernameView(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 void UsernameView::OnLocaleChanged() { 188 void UsernameView::OnLocaleChanged() {
189 if (is_guest_) { 189 if (is_guest_) {
190 SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST))); 190 SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST)));
191 text_image_.reset(); 191 text_image_.reset();
192 SchedulePaint(); 192 SchedulePaint();
193 } 193 }
194 } 194 }
195 195
196 } // namespace chromeos 196 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698