| 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/grit/generated_resources.h" | 7 #include "chrome/grit/generated_resources.h" |
| 8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" |
| 9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
| 10 #include "ui/views/controls/textfield/textfield.h" | 10 #include "ui/views/controls/textfield/textfield.h" |
| 11 #include "ui/views/layout/grid_layout.h" | 11 #include "ui/views/layout/grid_layout.h" |
| 12 #include "ui/views/layout/layout_constants.h" | 12 #include "ui/views/layout/layout_constants.h" |
| 13 | 13 |
| 14 #if defined(OS_MACOSX) |
| 15 static const int kMessageWidth = 365; |
| 16 static const int kTextfieldStackHorizontalSpacing = 10; |
| 17 #else |
| 14 static const int kMessageWidth = 320; | 18 static const int kMessageWidth = 320; |
| 15 static const int kTextfieldStackHorizontalSpacing = 30; | 19 static const int kTextfieldStackHorizontalSpacing = 30; |
| 20 #endif |
| 16 | 21 |
| 17 using password_manager::LoginModel; | 22 using password_manager::LoginModel; |
| 18 using views::GridLayout; | 23 using views::GridLayout; |
| 19 | 24 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
| 21 // LoginView, public: | 26 // LoginView, public: |
| 22 | 27 |
| 23 LoginView::LoginView(const base::string16& explanation, | 28 LoginView::LoginView(const base::string16& explanation, |
| 24 LoginModel* model) | 29 LoginModel* model) |
| 25 : username_field_(new views::Textfield()), | 30 : username_field_(new views::Textfield()), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 layout->StartRow(0, labels_column_set_id); | 71 layout->StartRow(0, labels_column_set_id); |
| 67 layout->AddView(username_label_); | 72 layout->AddView(username_label_); |
| 68 layout->AddView(username_field_); | 73 layout->AddView(username_field_); |
| 69 | 74 |
| 70 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 75 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 71 | 76 |
| 72 layout->StartRow(0, labels_column_set_id); | 77 layout->StartRow(0, labels_column_set_id); |
| 73 layout->AddView(password_label_); | 78 layout->AddView(password_label_); |
| 74 layout->AddView(password_field_); | 79 layout->AddView(password_field_); |
| 75 | 80 |
| 81 #if !defined(OS_MACOSX) |
| 82 // TODO(tapted): Is this ever needed? DialogClientView already adds |
| 83 // kRelatedControlVerticalSpacing to account for padding between the password |
| 84 // field and the buttons. |
| 76 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 85 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
| 86 #endif |
| 77 | 87 |
| 78 if (login_model_) | 88 if (login_model_) |
| 79 login_model_->AddObserver(this); | 89 login_model_->AddObserver(this); |
| 80 } | 90 } |
| 81 | 91 |
| 82 LoginView::~LoginView() { | 92 LoginView::~LoginView() { |
| 83 if (login_model_) | 93 if (login_model_) |
| 84 login_model_->RemoveObserver(this); | 94 login_model_->RemoveObserver(this); |
| 85 } | 95 } |
| 86 | 96 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 110 | 120 |
| 111 void LoginView::OnLoginModelDestroying() { | 121 void LoginView::OnLoginModelDestroying() { |
| 112 login_model_->RemoveObserver(this); | 122 login_model_->RemoveObserver(this); |
| 113 login_model_ = NULL; | 123 login_model_ = NULL; |
| 114 } | 124 } |
| 115 | 125 |
| 116 const char* LoginView::GetClassName() const { | 126 const char* LoginView::GetClassName() const { |
| 117 return "LoginView"; | 127 return "LoginView"; |
| 118 } | 128 } |
| 119 | 129 |
| OLD | NEW |