OLD | NEW |
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" |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "chrome/browser/views/login_view.h" | |
8 | |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/compiler_specific.h" |
10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
12 #include "views/grid_layout.h" | 13 #include "views/grid_layout.h" |
13 #include "views/controls/label.h" | 14 #include "views/controls/label.h" |
14 #include "views/controls/text_field.h" | 15 #include "views/controls/text_field.h" |
15 #include "views/standard_layout.h" | 16 #include "views/standard_layout.h" |
16 #include "views/widget/root_view.h" | 17 #include "views/widget/root_view.h" |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
20 static const int kMessageWidth = 320; | 21 static const int kMessageWidth = 320; |
21 static const int kTextFieldStackHorizontalSpacing = 30; | 22 static const int kTextFieldStackHorizontalSpacing = 30; |
22 | 23 |
23 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
24 // LoginView, public: | 25 // LoginView, public: |
25 | 26 |
26 LoginView::LoginView(const std::wstring& explanation) | 27 LoginView::LoginView(const std::wstring& explanation) |
27 : username_field_(new TextField), | 28 : username_field_(new TextField), |
28 password_field_(new TextField(TextField::STYLE_PASSWORD)), | 29 password_field_(new TextField(TextField::STYLE_PASSWORD)), |
29 username_label_(new Label( | 30 username_label_(new Label( |
30 l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))), | 31 l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))), |
31 password_label_(new Label( | 32 password_label_(new Label( |
32 l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), | 33 l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), |
33 message_label_(new Label(explanation)), | 34 message_label_(new Label(explanation)), |
34 focus_grabber_factory_(this), | 35 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), |
35 login_model_(NULL) { | 36 login_model_(NULL) { |
36 message_label_->SetMultiLine(true); | 37 message_label_->SetMultiLine(true); |
37 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 38 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); |
38 | 39 |
39 // Initialize the Grid Layout Manager used for this dialog box. | 40 // Initialize the Grid Layout Manager used for this dialog box. |
40 GridLayout* layout = CreatePanelGridLayout(this); | 41 GridLayout* layout = CreatePanelGridLayout(this); |
41 SetLayoutManager(layout); | 42 SetLayoutManager(layout); |
42 | 43 |
43 // Add the column set for the information message at the top of the dialog | 44 // Add the column set for the information message at the top of the dialog |
44 // box. | 45 // box. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 115 } |
115 | 116 |
116 /////////////////////////////////////////////////////////////////////////////// | 117 /////////////////////////////////////////////////////////////////////////////// |
117 // LoginView, private: | 118 // LoginView, private: |
118 | 119 |
119 void LoginView::FocusFirstField() { | 120 void LoginView::FocusFirstField() { |
120 username_field_->RequestFocus(); | 121 username_field_->RequestFocus(); |
121 } | 122 } |
122 | 123 |
123 } // namespace | 124 } // namespace |
OLD | NEW |