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

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

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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) 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/user_controller.h" 5 #include "chrome/browser/chromeos/login/user_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 452 }
453 UpdateUserCount(index, total_user_count); 453 UpdateUserCount(index, total_user_count);
454 454
455 GdkWindow* gdk_window = border_window_->GetNativeView()->window; 455 GdkWindow* gdk_window = border_window_->GetNativeView()->window;
456 gdk_window_set_back_pixmap(gdk_window, NULL, false); 456 gdk_window_set_back_pixmap(gdk_window, NULL, false);
457 457
458 border_window_->Show(); 458 border_window_->Show();
459 } 459 }
460 460
461 Widget* UserController::CreateLabelWidget(int index, WmIpcWindowType type) { 461 Widget* UserController::CreateLabelWidget(int index, WmIpcWindowType type) {
462 std::wstring text; 462 string16 text;
463 if (is_guest_) { 463 if (is_guest_) {
464 text = std::wstring(); 464 text = string16();
465 } else if (is_new_user_) { 465 } else if (is_new_user_) {
466 // Add user should have label only in activated state. 466 // Add user should have label only in activated state.
467 // When new user is the only, label is not needed. 467 // When new user is the only, label is not needed.
468 if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0) 468 if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0)
469 text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER)); 469 text = l10n_util::GetStringUTF16(IDS_ADD_USER);
470 } else { 470 } else {
471 text = UTF8ToWide(user_.GetDisplayName()); 471 text = UTF8ToUTF16(user_.GetDisplayName());
472 } 472 }
473 473
474 views::Label* label = NULL; 474 views::Label* label = NULL;
475 475
476 if (is_new_user_) { 476 if (is_new_user_) {
477 label = new views::Label(text); 477 label = new views::Label(text);
478 } else if (type == WM_IPC_WINDOW_LOGIN_LABEL) { 478 } else if (type == WM_IPC_WINDOW_LOGIN_LABEL) {
479 label = UsernameView::CreateShapedUsernameView(text, false); 479 label = UsernameView::CreateShapedUsernameView(UTF16ToWide(text), false);
480 } else { 480 } else {
481 DCHECK(type == WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL); 481 DCHECK(type == WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL);
482 // TODO(altimofeev): switch to the rounded username view. 482 // TODO(altimofeev): switch to the rounded username view.
483 label = UsernameView::CreateShapedUsernameView(text, true); 483 label = UsernameView::CreateShapedUsernameView(
484 UTF16ToWideHack(text), true);
484 } 485 }
485 486
486 const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? 487 const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ?
487 GetLabelFont() : GetUnselectedLabelFont(); 488 GetLabelFont() : GetUnselectedLabelFont();
488 label->SetFont(font); 489 label->SetFont(font);
489 label->SetColor(login::kTextColor); 490 label->SetColor(login::kTextColor);
490 491
491 if (type == WM_IPC_WINDOW_LOGIN_LABEL) 492 if (type == WM_IPC_WINDOW_LOGIN_LABEL)
492 label_view_ = label; 493 label_view_ = label;
493 else 494 else
(...skipping 28 matching lines...) Expand all
522 string16 UserController::GetNameTooltip() const { 523 string16 UserController::GetNameTooltip() const {
523 if (is_new_user_) 524 if (is_new_user_)
524 return l10n_util::GetStringUTF16(IDS_ADD_USER); 525 return l10n_util::GetStringUTF16(IDS_ADD_USER);
525 else if (is_guest_) 526 else if (is_guest_)
526 return l10n_util::GetStringUTF16(IDS_GO_INCOGNITO_BUTTON); 527 return l10n_util::GetStringUTF16(IDS_GO_INCOGNITO_BUTTON);
527 else 528 else
528 return UTF8ToUTF16(user_.GetNameTooltip()); 529 return UTF8ToUTF16(user_.GetNameTooltip());
529 } 530 }
530 531
531 } // namespace chromeos 532 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/update_view.cc ('k') | chrome/browser/chromeos/login/user_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698