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

Side by Side Diff: chrome/browser/views/login_view.cc

Issue 113940: Make Textfield more portable.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
« no previous file with comments | « chrome/browser/views/find_bar_view.cc ('k') | chrome/browser/views/options/cookies_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/login_view.h" 5 #include "chrome/browser/views/login_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); 77 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
78 } 78 }
79 79
80 LoginView::~LoginView() { 80 LoginView::~LoginView() {
81 if (login_model_) 81 if (login_model_)
82 login_model_->SetObserver(NULL); 82 login_model_->SetObserver(NULL);
83 } 83 }
84 84
85 std::wstring LoginView::GetUsername() { 85 std::wstring LoginView::GetUsername() {
86 return username_field_->GetText(); 86 return username_field_->text();
87 } 87 }
88 88
89 std::wstring LoginView::GetPassword() { 89 std::wstring LoginView::GetPassword() {
90 return password_field_->GetText(); 90 return password_field_->text();
91 } 91 }
92 92
93 void LoginView::SetModel(LoginModel* model) { 93 void LoginView::SetModel(LoginModel* model) {
94 login_model_ = model; 94 login_model_ = model;
95 if (login_model_) 95 if (login_model_)
96 login_model_->SetObserver(this); 96 login_model_->SetObserver(this);
97 } 97 }
98 /////////////////////////////////////////////////////////////////////////////// 98 ///////////////////////////////////////////////////////////////////////////////
99 // LoginView, views::View, views::LoginModelObserver overrides: 99 // LoginView, views::View, views::LoginModelObserver overrides:
100 100
101 void LoginView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { 101 void LoginView::ViewHierarchyChanged(bool is_add, View *parent, View *child) {
102 if (is_add && child == this) { 102 if (is_add && child == this) {
103 MessageLoop::current()->PostTask(FROM_HERE, 103 MessageLoop::current()->PostTask(FROM_HERE,
104 focus_grabber_factory_.NewRunnableMethod(&LoginView::FocusFirstField)); 104 focus_grabber_factory_.NewRunnableMethod(&LoginView::FocusFirstField));
105 } 105 }
106 } 106 }
107 107
108 void LoginView::OnAutofillDataAvailable(const std::wstring& username, 108 void LoginView::OnAutofillDataAvailable(const std::wstring& username,
109 const std::wstring& password) { 109 const std::wstring& password) {
110 if (username_field_->GetText().empty()) { 110 if (username_field_->text().empty()) {
111 username_field_->SetText(username); 111 username_field_->SetText(username);
112 password_field_->SetText(password); 112 password_field_->SetText(password);
113 username_field_->SelectAll(); 113 username_field_->SelectAll();
114 } 114 }
115 } 115 }
116 116
117 /////////////////////////////////////////////////////////////////////////////// 117 ///////////////////////////////////////////////////////////////////////////////
118 // LoginView, private: 118 // LoginView, private:
119 119
120 void LoginView::FocusFirstField() { 120 void LoginView::FocusFirstField() {
121 username_field_->RequestFocus(); 121 username_field_->RequestFocus();
122 } 122 }
123 123
124 } // namespace 124 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/views/find_bar_view.cc ('k') | chrome/browser/views/options/cookies_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698