| 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/ui/views/login_view.h" | 5 #include "chrome/browser/ui/views/login_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static const int kTextfieldStackHorizontalSpacing = 30; | 21 static const int kTextfieldStackHorizontalSpacing = 30; |
| 22 | 22 |
| 23 using views::GridLayout; | 23 using views::GridLayout; |
| 24 | 24 |
| 25 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
| 26 // LoginView, public: | 26 // LoginView, public: |
| 27 | 27 |
| 28 LoginView::LoginView(const std::wstring& explanation, LoginModel* model) | 28 LoginView::LoginView(const std::wstring& explanation, LoginModel* model) |
| 29 : username_field_(new views::Textfield), | 29 : username_field_(new views::Textfield), |
| 30 password_field_(new views::Textfield(views::Textfield::STYLE_PASSWORD)), | 30 password_field_(new views::Textfield(views::Textfield::STYLE_PASSWORD)), |
| 31 username_label_(new views::Label( | 31 username_label_(new views::Label(UTF16ToWide( |
| 32 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD))), | 32 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD)))), |
| 33 password_label_(new views::Label( | 33 password_label_(new views::Label(UTF16ToWide( |
| 34 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), | 34 l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD)))), |
| 35 message_label_(new views::Label(explanation)), | 35 message_label_(new views::Label(explanation)), |
| 36 login_model_(model) { | 36 login_model_(model) { |
| 37 message_label_->SetMultiLine(true); | 37 message_label_->SetMultiLine(true); |
| 38 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 38 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 39 message_label_->SetAllowCharacterBreak(true); | 39 message_label_->SetAllowCharacterBreak(true); |
| 40 | 40 |
| 41 // Initialize the Grid Layout Manager used for this dialog box. | 41 // Initialize the Grid Layout Manager used for this dialog box. |
| 42 GridLayout* layout = GridLayout::CreatePanel(this); | 42 GridLayout* layout = GridLayout::CreatePanel(this); |
| 43 SetLayoutManager(layout); | 43 SetLayoutManager(layout); |
| 44 | 44 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // LoginView, views::View, views::LoginModelObserver overrides: | 103 // LoginView, views::View, views::LoginModelObserver overrides: |
| 104 | 104 |
| 105 void LoginView::OnAutofillDataAvailable(const std::wstring& username, | 105 void LoginView::OnAutofillDataAvailable(const std::wstring& username, |
| 106 const std::wstring& password) { | 106 const std::wstring& password) { |
| 107 if (username_field_->text().empty()) { | 107 if (username_field_->text().empty()) { |
| 108 username_field_->SetText(username); | 108 username_field_->SetText(username); |
| 109 password_field_->SetText(password); | 109 password_field_->SetText(password); |
| 110 username_field_->SelectAll(); | 110 username_field_->SelectAll(); |
| 111 } | 111 } |
| 112 } | 112 } |
| OLD | NEW |