Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/options/passwords_page_view.h" | 5 #include "chrome/browser/views/options/passwords_page_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/password_manager/password_store.h" | 9 #include "chrome/browser/password_manager/password_store.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| 11 #include "chrome/browser/views/confirm_message_box_dialog.h" | |
| 11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 12 #include "chrome/common/pref_service.h" | 13 #include "chrome/common/pref_service.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "views/background.h" | 15 #include "views/background.h" |
| 15 #include "views/controls/button/native_button.h" | 16 #include "views/controls/button/native_button.h" |
| 16 #include "views/grid_layout.h" | 17 #include "views/grid_layout.h" |
| 17 #include "views/standard_layout.h" | 18 #include "views/standard_layout.h" |
| 18 | 19 |
| 19 using views::ColumnSet; | 20 using views::ColumnSet; |
| 20 using views::GridLayout; | 21 using views::GridLayout; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 show_button_.SetEnabled(has_selection); | 207 show_button_.SetEnabled(has_selection); |
| 207 password_label_.SetText(std::wstring()); | 208 password_label_.SetText(std::wstring()); |
| 208 | 209 |
| 209 current_selected_password_ = selected; | 210 current_selected_password_ = selected; |
| 210 } | 211 } |
| 211 } | 212 } |
| 212 | 213 |
| 213 void PasswordsPageView::ButtonPressed(views::Button* sender) { | 214 void PasswordsPageView::ButtonPressed(views::Button* sender) { |
| 214 // Close will result in our destruction. | 215 // Close will result in our destruction. |
| 215 if (sender == &remove_all_button_) { | 216 if (sender == &remove_all_button_) { |
| 216 table_model_.ForgetAndRemoveAllSignons(); | 217 bool accepted = ConfirmMessageBoxDialog::Run( |
| 218 GetWindow()->GetNativeWindow(), | |
|
tim (not reviewing)
2009/07/14 18:34:52
I guess I should have pointed out that the 4 space
| |
| 219 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_TEXT_DELETE_ALL_PASSWORDS), | |
| 220 l10n_util::GetString( | |
| 221 IDS_PASSWORDS_PAGE_VIEW_CAPTION_DELETE_ALL_PASSWORDS)); | |
| 222 | |
| 223 if (accepted) { | |
| 224 // Delete all the Passwords shown. | |
| 225 table_model_.ForgetAndRemoveAllSignons(); | |
| 226 } | |
| 217 return; | 227 return; |
| 218 } | 228 } |
| 219 | 229 |
| 220 // The following require a selection (and only one, since table is single- | 230 // The following require a selection (and only one, since table is single- |
| 221 // select only). | 231 // select only). |
| 222 views::TableSelectionIterator iter = table_view_->SelectionBegin(); | 232 views::TableSelectionIterator iter = table_view_->SelectionBegin(); |
| 223 int row = *iter; | 233 int row = *iter; |
| 224 PasswordForm* selected = table_model_.GetPasswordFormAt(row); | 234 PasswordForm* selected = table_model_.GetPasswordFormAt(row); |
| 225 DCHECK(++iter == table_view_->SelectionEnd()); | 235 DCHECK(++iter == table_view_->SelectionEnd()); |
| 226 | 236 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 columns.back().sortable = true; | 329 columns.back().sortable = true; |
| 320 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, | 330 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, |
| 321 true, true, true); | 331 true, true, true); |
| 322 // Make the table initially sorted by host. | 332 // Make the table initially sorted by host. |
| 323 views::TableView::SortDescriptors sort; | 333 views::TableView::SortDescriptors sort; |
| 324 sort.push_back(views::TableView::SortDescriptor( | 334 sort.push_back(views::TableView::SortDescriptor( |
| 325 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); | 335 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); |
| 326 table_view_->SetSortDescriptors(sort); | 336 table_view_->SetSortDescriptors(sort); |
| 327 table_view_->SetObserver(this); | 337 table_view_->SetObserver(this); |
| 328 } | 338 } |
| OLD | NEW |