OLD | NEW |
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/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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void UserController::StartThrobber() { | 185 void UserController::StartThrobber() { |
186 throbber_host_->StartThrobber(); | 186 throbber_host_->StartThrobber(); |
187 } | 187 } |
188 | 188 |
189 void UserController::StopThrobber() { | 189 void UserController::StopThrobber() { |
190 throbber_host_->StopThrobber(); | 190 throbber_host_->StopThrobber(); |
191 } | 191 } |
192 | 192 |
193 std::wstring UserController::GetNameTooltip() const { | 193 std::wstring UserController::GetNameTooltip() const { |
194 if (is_new_user_) | 194 if (is_new_user_) |
195 return l10n_util::GetString(IDS_ADD_USER); | 195 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER)); |
196 if (is_guest_) | 196 if (is_guest_) |
197 return l10n_util::GetString(IDS_GO_INCOGNITO_BUTTON); | 197 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_GO_INCOGNITO_BUTTON)); |
198 | 198 |
199 // Tooltip contains user's display name and his email domain to distinguish | 199 // Tooltip contains user's display name and his email domain to distinguish |
200 // this user from the other one with the same display name. | 200 // this user from the other one with the same display name. |
201 const std::string& email = user_.email(); | 201 const std::string& email = user_.email(); |
202 size_t at_pos = email.rfind('@'); | 202 size_t at_pos = email.rfind('@'); |
203 if (at_pos == std::string::npos) { | 203 if (at_pos == std::string::npos) { |
204 NOTREACHED(); | 204 NOTREACHED(); |
205 return std::wstring(); | 205 return std::wstring(); |
206 } | 206 } |
207 size_t domain_start = at_pos + 1; | 207 size_t domain_start = at_pos + 1; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 WidgetGtk* UserController::CreateLabelWindow(int index, | 409 WidgetGtk* UserController::CreateLabelWindow(int index, |
410 WmIpcWindowType type) { | 410 WmIpcWindowType type) { |
411 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 411 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
412 const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? | 412 const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? |
413 rb.GetFont(ResourceBundle::MediumBoldFont) : | 413 rb.GetFont(ResourceBundle::MediumBoldFont) : |
414 rb.GetFont(ResourceBundle::BaseFont).DeriveFont( | 414 rb.GetFont(ResourceBundle::BaseFont).DeriveFont( |
415 kUnselectedUsernameFontDelta, gfx::Font::BOLD); | 415 kUnselectedUsernameFontDelta, gfx::Font::BOLD); |
416 std::wstring text; | 416 std::wstring text; |
417 if (is_guest_) { | 417 if (is_guest_) { |
418 text = l10n_util::GetString(IDS_GUEST); | 418 text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST)); |
419 } else if (is_new_user_) { | 419 } else if (is_new_user_) { |
420 // Add user should have label only in activated state. | 420 // Add user should have label only in activated state. |
421 // When new user is the only, label is not needed. | 421 // When new user is the only, label is not needed. |
422 if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0) | 422 if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0) |
423 text = l10n_util::GetString(IDS_ADD_USER); | 423 text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER)); |
424 } else { | 424 } else { |
425 text = UTF8ToWide(user_.GetDisplayName()); | 425 text = UTF8ToWide(user_.GetDisplayName()); |
426 } | 426 } |
427 | 427 |
428 views::Label *label = NULL; | 428 views::Label *label = NULL; |
429 | 429 |
430 if (is_new_user_) { | 430 if (is_new_user_) { |
431 label = new views::Label(text); | 431 label = new views::Label(text); |
432 } else if (type == WM_IPC_WINDOW_LOGIN_LABEL) { | 432 } else if (type == WM_IPC_WINDOW_LOGIN_LABEL) { |
433 label = UsernameView::CreateShapedUsernameView(text, false); | 433 label = UsernameView::CreateShapedUsernameView(text, false); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 return; | 509 return; |
510 } | 510 } |
511 delegate_->RemoveUser(this); | 511 delegate_->RemoveUser(this); |
512 } | 512 } |
513 | 513 |
514 void UserController::SelectUserRelative(int shift) { | 514 void UserController::SelectUserRelative(int shift) { |
515 delegate_->SelectUser(user_index() + shift); | 515 delegate_->SelectUser(user_index() + shift); |
516 } | 516 } |
517 | 517 |
518 } // namespace chromeos | 518 } // namespace chromeos |
OLD | NEW |