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 "chrome/browser/ui/views/harmony/layout_delegate.h" | 7 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
8 #include "chrome/browser/ui/views/layout_utils.h" | 8 #include "chrome/browser/ui/views/layout_utils.h" |
9 #include "components/strings/grit/components_strings.h" | 9 #include "components/strings/grit/components_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 51 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
52 GridLayout::FIXED, kMessageWidth, 0); | 52 GridLayout::FIXED, kMessageWidth, 0); |
53 | 53 |
54 // Add the column set for the user name and password fields and labels. | 54 // Add the column set for the user name and password fields and labels. |
55 const int labels_column_set_id = 1; | 55 const int labels_column_set_id = 1; |
56 column_set = layout->AddColumnSet(labels_column_set_id); | 56 column_set = layout->AddColumnSet(labels_column_set_id); |
57 if (layout_delegate->UseExtraDialogPadding()) | 57 if (layout_delegate->UseExtraDialogPadding()) |
58 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); | 58 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); |
59 column_set->AddColumn(layout_delegate->GetControlLabelGridAlignment(), | 59 column_set->AddColumn(layout_delegate->GetControlLabelGridAlignment(), |
60 GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); | 60 GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); |
61 column_set->AddPaddingColumn(0, layout_delegate->GetLayoutDistance( | 61 column_set->AddPaddingColumn( |
62 LayoutDelegate::LayoutDistanceType:: | 62 0, |
63 RELATED_CONTROL_HORIZONTAL_SPACING)); | 63 layout_delegate->GetMetric( |
| 64 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); |
64 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, | 65 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, |
65 GridLayout::USE_PREF, 0, 0); | 66 GridLayout::USE_PREF, 0, 0); |
66 if (layout_delegate->UseExtraDialogPadding()) | 67 if (layout_delegate->UseExtraDialogPadding()) |
67 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); | 68 column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); |
68 | 69 |
69 layout->StartRow(0, single_column_view_set_id); | 70 layout->StartRow(0, single_column_view_set_id); |
70 layout->AddView(authority_label_); | 71 layout->AddView(authority_label_); |
71 if (!explanation.empty()) { | 72 if (!explanation.empty()) { |
72 message_label_ = new views::Label(explanation); | 73 message_label_ = new views::Label(explanation); |
73 message_label_->SetMultiLine(true); | 74 message_label_->SetMultiLine(true); |
74 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 75 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
75 message_label_->SetAllowCharacterBreak(true); | 76 message_label_->SetAllowCharacterBreak(true); |
76 layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance( | 77 layout->AddPaddingRow( |
77 LayoutDelegate::LayoutDistanceType:: | 78 0, |
78 RELATED_CONTROL_VERTICAL_SPACING)); | 79 layout_delegate->GetMetric( |
| 80 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); |
79 layout->StartRow(0, single_column_view_set_id); | 81 layout->StartRow(0, single_column_view_set_id); |
80 layout->AddView(message_label_); | 82 layout->AddView(message_label_); |
81 } | 83 } |
82 | 84 |
83 layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance( | 85 layout->AddPaddingRow( |
84 LayoutDelegate::LayoutDistanceType:: | 86 0, |
85 UNRELATED_CONTROL_VERTICAL_SPACING_LARGE)); | 87 layout_delegate->GetMetric( |
| 88 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE)); |
86 | 89 |
87 layout->StartRow(0, labels_column_set_id); | 90 layout->StartRow(0, labels_column_set_id); |
88 layout->AddView(username_label_); | 91 layout->AddView(username_label_); |
89 layout->AddView(username_field_); | 92 layout->AddView(username_field_); |
90 | 93 |
91 layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance( | 94 layout->AddPaddingRow( |
92 LayoutDelegate::LayoutDistanceType:: | 95 0, |
93 RELATED_CONTROL_VERTICAL_SPACING)); | 96 layout_delegate->GetMetric( |
| 97 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); |
94 | 98 |
95 layout->StartRow(0, labels_column_set_id); | 99 layout->StartRow(0, labels_column_set_id); |
96 layout->AddView(password_label_); | 100 layout->AddView(password_label_); |
97 layout->AddView(password_field_); | 101 layout->AddView(password_field_); |
98 | 102 |
99 if (layout_delegate->UseExtraDialogPadding()) { | 103 if (layout_delegate->UseExtraDialogPadding()) { |
100 layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance( | 104 layout->AddPaddingRow( |
101 LayoutDelegate::LayoutDistanceType:: | 105 0, |
102 UNRELATED_CONTROL_VERTICAL_SPACING)); | 106 layout_delegate->GetMetric( |
| 107 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
103 } | 108 } |
104 | 109 |
105 if (login_model_data) { | 110 if (login_model_data) { |
106 login_model_->AddObserverAndDeliverCredentials(this, | 111 login_model_->AddObserverAndDeliverCredentials(this, |
107 login_model_data->form); | 112 login_model_data->form); |
108 } | 113 } |
109 } | 114 } |
110 | 115 |
111 LoginView::~LoginView() { | 116 LoginView::~LoginView() { |
112 if (login_model_) | 117 if (login_model_) |
(...skipping 27 matching lines...) Expand all Loading... |
140 | 145 |
141 void LoginView::OnLoginModelDestroying() { | 146 void LoginView::OnLoginModelDestroying() { |
142 login_model_->RemoveObserver(this); | 147 login_model_->RemoveObserver(this); |
143 login_model_ = NULL; | 148 login_model_ = NULL; |
144 } | 149 } |
145 | 150 |
146 const char* LoginView::GetClassName() const { | 151 const char* LoginView::GetClassName() const { |
147 return "LoginView"; | 152 return "LoginView"; |
148 } | 153 } |
149 | 154 |
OLD | NEW |