| Index: chrome/browser/chromeos/login/new_user_view.cc
|
| diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
|
| index d340a0ba4ade4d0bd62bd0499417415f76c54866..0f469731757d5be908c5dd4f86203a96073972c1 100644
|
| --- a/chrome/browser/chromeos/login/new_user_view.cc
|
| +++ b/chrome/browser/chromeos/login/new_user_view.cc
|
| @@ -63,14 +63,20 @@ class UsernameField : public chromeos::TextfieldWithMargin {
|
|
|
| // views::Textfield overrides:
|
| virtual void WillLoseFocus() {
|
| - if (!text().empty()) {
|
| - std::string username = UTF16ToUTF8(text());
|
| + string16 user_input;
|
| + bool was_trim = TrimWhitespace(text(), TRIM_ALL, &user_input) != TRIM_NONE;
|
| + if (!user_input.empty()) {
|
| + std::string username = UTF16ToUTF8(user_input);
|
|
|
| if (username.find('@') == std::string::npos) {
|
| username += kDefaultDomain;
|
| SetText(UTF8ToUTF16(username));
|
| + was_trim = false;
|
| }
|
| }
|
| +
|
| + if (was_trim)
|
| + SetText(user_input);
|
| }
|
|
|
| // Overridden from views::View:
|
|
|