OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/passwords/manage_password_items_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 7 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
10 #include "grit/components_strings.h" | 10 #include "grit/components_strings.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 AddUndoRow(layout); | 140 AddUndoRow(layout); |
141 } else { | 141 } else { |
142 AddCredentialsRow(layout); | 142 AddCredentialsRow(layout); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void ManagePasswordItemsView::PasswordFormRow::AddCredentialsRow( | 146 void ManagePasswordItemsView::PasswordFormRow::AddCredentialsRow( |
147 views::GridLayout* layout) { | 147 views::GridLayout* layout) { |
148 ResetControls(); | 148 ResetControls(); |
149 int column_set_id = | 149 int column_set_id = |
150 password_manager::ui::IsPendingState(host_->model_->state()) | 150 host_->model_->state() == password_manager::ui::PENDING_PASSWORD_STATE |
151 ? TWO_COLUMN_SET | 151 ? TWO_COLUMN_SET |
152 : THREE_COLUMN_SET; | 152 : THREE_COLUMN_SET; |
153 BuildColumnSetIfNeeded(layout, column_set_id); | 153 BuildColumnSetIfNeeded(layout, column_set_id); |
154 layout->StartRowWithPadding(0, column_set_id, 0, | 154 layout->StartRowWithPadding(0, column_set_id, 0, |
155 views::kRelatedControlVerticalSpacing); | 155 views::kRelatedControlVerticalSpacing); |
156 layout->AddView(GenerateUsernameLabel(*password_form_)); | 156 layout->AddView(GenerateUsernameLabel(*password_form_)); |
157 layout->AddView(GeneratePasswordLabel(*password_form_)); | 157 layout->AddView(GeneratePasswordLabel(*password_form_)); |
158 if (column_set_id == THREE_COLUMN_SET) { | 158 if (column_set_id == THREE_COLUMN_SET) { |
159 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 159 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
160 delete_button_ = new views::ImageButton(this); | 160 delete_button_ = new views::ImageButton(this); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 Refresh(); | 241 Refresh(); |
242 // After the view is consistent, notify the model that the password needs to | 242 // After the view is consistent, notify the model that the password needs to |
243 // be updated (either removed or put back into the store, as appropriate. | 243 // be updated (either removed or put back into the store, as appropriate. |
244 model_->OnPasswordAction(password_form, | 244 model_->OnPasswordAction(password_form, |
245 deleted | 245 deleted |
246 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD | 246 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD |
247 : ManagePasswordsBubbleModel::ADD_PASSWORD); | 247 : ManagePasswordsBubbleModel::ADD_PASSWORD); |
248 } | 248 } |
249 | 249 |
250 void ManagePasswordItemsView::Refresh() { | 250 void ManagePasswordItemsView::Refresh() { |
251 DCHECK(!password_manager::ui::IsPendingState(model_->state())); | 251 DCHECK_NE(password_manager::ui::PENDING_PASSWORD_STATE, model_->state()); |
252 RemoveAllChildViews(true); | 252 RemoveAllChildViews(true); |
253 AddRows(); | 253 AddRows(); |
254 } | 254 } |
OLD | NEW |