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

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

Issue 115825: Move text_field.cc and rename the class to Textfield in preparation for porti... (Closed) Base URL: svn://chrome-svn/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/login_view.h ('k') | chrome/browser/views/new_profile_dialog.h » ('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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "views/grid_layout.h" 13 #include "views/grid_layout.h"
14 #include "views/controls/label.h" 14 #include "views/controls/label.h"
15 #include "views/controls/text_field.h" 15 #include "views/controls/textfield/textfield.h"
16 #include "views/standard_layout.h" 16 #include "views/standard_layout.h"
17 #include "views/widget/root_view.h" 17 #include "views/widget/root_view.h"
18 18
19 namespace views { 19 namespace views {
20 20
21 static const int kMessageWidth = 320; 21 static const int kMessageWidth = 320;
22 static const int kTextFieldStackHorizontalSpacing = 30; 22 static const int kTextfieldStackHorizontalSpacing = 30;
23 23
24 /////////////////////////////////////////////////////////////////////////////// 24 ///////////////////////////////////////////////////////////////////////////////
25 // LoginView, public: 25 // LoginView, public:
26 26
27 LoginView::LoginView(const std::wstring& explanation) 27 LoginView::LoginView(const std::wstring& explanation)
28 : username_field_(new TextField), 28 : username_field_(new Textfield),
29 password_field_(new TextField(TextField::STYLE_PASSWORD)), 29 password_field_(new Textfield(Textfield::STYLE_PASSWORD)),
30 username_label_(new Label( 30 username_label_(new Label(
31 l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))), 31 l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))),
32 password_label_(new Label( 32 password_label_(new Label(
33 l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), 33 l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))),
34 message_label_(new Label(explanation)), 34 message_label_(new Label(explanation)),
35 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), 35 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)),
36 login_model_(NULL) { 36 login_model_(NULL) {
37 message_label_->SetMultiLine(true); 37 message_label_->SetMultiLine(true);
38 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 38 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
39 39
40 // Initialize the Grid Layout Manager used for this dialog box. 40 // Initialize the Grid Layout Manager used for this dialog box.
41 GridLayout* layout = CreatePanelGridLayout(this); 41 GridLayout* layout = CreatePanelGridLayout(this);
42 SetLayoutManager(layout); 42 SetLayoutManager(layout);
43 43
44 // 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
45 // box. 45 // box.
46 const int single_column_view_set_id = 0; 46 const int single_column_view_set_id = 0;
47 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); 47 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id);
48 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, 48 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
49 GridLayout::FIXED, kMessageWidth, 0); 49 GridLayout::FIXED, kMessageWidth, 0);
50 50
51 // Add the column set for the user name and password fields and labels. 51 // Add the column set for the user name and password fields and labels.
52 const int labels_column_set_id = 1; 52 const int labels_column_set_id = 1;
53 column_set = layout->AddColumnSet(labels_column_set_id); 53 column_set = layout->AddColumnSet(labels_column_set_id);
54 column_set->AddPaddingColumn(0, kTextFieldStackHorizontalSpacing); 54 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
55 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, 55 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
56 GridLayout::USE_PREF, 0, 0); 56 GridLayout::USE_PREF, 0, 0);
57 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); 57 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
58 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, 58 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
59 GridLayout::USE_PREF, 0, 0); 59 GridLayout::USE_PREF, 0, 0);
60 column_set->AddPaddingColumn(0, kTextFieldStackHorizontalSpacing); 60 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
61 61
62 layout->StartRow(0, single_column_view_set_id); 62 layout->StartRow(0, single_column_view_set_id);
63 layout->AddView(message_label_); 63 layout->AddView(message_label_);
64 64
65 layout->AddPaddingRow(0, kUnrelatedControlLargeVerticalSpacing); 65 layout->AddPaddingRow(0, kUnrelatedControlLargeVerticalSpacing);
66 66
67 layout->StartRow(0, labels_column_set_id); 67 layout->StartRow(0, labels_column_set_id);
68 layout->AddView(username_label_); 68 layout->AddView(username_label_);
69 layout->AddView(username_field_); 69 layout->AddView(username_field_);
70 70
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/login_view.h ('k') | chrome/browser/views/new_profile_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698