| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if (login_model_) | 82 if (login_model_) |
| 83 login_model_->AddObserver(this); | 83 login_model_->AddObserver(this); |
| 84 } | 84 } |
| 85 | 85 |
| 86 LoginView::~LoginView() { | 86 LoginView::~LoginView() { |
| 87 if (login_model_) | 87 if (login_model_) |
| 88 login_model_->RemoveObserver(this); | 88 login_model_->RemoveObserver(this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 base::string16 LoginView::GetUsername() { | 91 base::string16 LoginView::GetUsername() { |
| 92 return username_field_->text(); | 92 return username_field_->GetText(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 base::string16 LoginView::GetPassword() { | 95 base::string16 LoginView::GetPassword() { |
| 96 return password_field_->text(); | 96 return password_field_->GetText(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 views::View* LoginView::GetInitiallyFocusedView() { | 99 views::View* LoginView::GetInitiallyFocusedView() { |
| 100 return username_field_; | 100 return username_field_; |
| 101 } | 101 } |
| 102 | 102 |
| 103 /////////////////////////////////////////////////////////////////////////////// | 103 /////////////////////////////////////////////////////////////////////////////// |
| 104 // LoginView, views::View, views::LoginModelObserver overrides: | 104 // LoginView, views::View, views::LoginModelObserver overrides: |
| 105 | 105 |
| 106 void LoginView::OnAutofillDataAvailable(const base::string16& username, | 106 void LoginView::OnAutofillDataAvailable(const base::string16& username, |
| 107 const base::string16& password) { | 107 const base::string16& password) { |
| 108 if (username_field_->text().empty()) { | 108 if (username_field_->GetText().empty()) { |
| 109 username_field_->SetText(username); | 109 username_field_->SetText(username); |
| 110 password_field_->SetText(password); | 110 password_field_->SetText(password); |
| 111 username_field_->SelectAll(true); | 111 username_field_->SelectAll(true); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 void LoginView::OnLoginModelDestroying() { | 115 void LoginView::OnLoginModelDestroying() { |
| 116 login_model_->RemoveObserver(this); | 116 login_model_->RemoveObserver(this); |
| 117 login_model_ = NULL; | 117 login_model_ = NULL; |
| 118 } | 118 } |
| OLD | NEW |