| 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/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (pending_login_query_) { | 176 if (pending_login_query_) { |
| 177 web_data_service()->CancelRequest(pending_login_query_); | 177 web_data_service()->CancelRequest(pending_login_query_); |
| 178 pending_login_query_ = NULL; | 178 pending_login_query_ = NULL; |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 /////////////////////////////////////////////////////////////////////////////// | 182 /////////////////////////////////////////////////////////////////////////////// |
| 183 // PasswordsPageView, public | 183 // PasswordsPageView, public |
| 184 PasswordsPageView::PasswordsPageView(Profile* profile) | 184 PasswordsPageView::PasswordsPageView(Profile* profile) |
| 185 : OptionsPageView(profile), | 185 : OptionsPageView(profile), |
| 186 show_button_( | 186 ALLOW_THIS_IN_INITIALIZER_LIST(show_button_( |
| 187 this, | 187 this, |
| 188 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON), | 188 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON), |
| 189 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)), | 189 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON))), |
| 190 remove_button_(this, l10n_util::GetString( | 190 ALLOW_THIS_IN_INITIALIZER_LIST(remove_button_( |
| 191 IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON)), | 191 this, |
| 192 remove_all_button_(this, l10n_util::GetString( | 192 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON))), |
| 193 IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON)), | 193 ALLOW_THIS_IN_INITIALIZER_LIST(remove_all_button_( |
| 194 this, |
| 195 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON))), |
| 194 table_model_(profile), | 196 table_model_(profile), |
| 195 table_view_(NULL) { | 197 table_view_(NULL) { |
| 196 } | 198 } |
| 197 | 199 |
| 198 void PasswordsPageView::OnSelectionChanged() { | 200 void PasswordsPageView::OnSelectionChanged() { |
| 199 bool has_selection = table_view_->SelectedRowCount() > 0; | 201 bool has_selection = table_view_->SelectedRowCount() > 0; |
| 200 remove_button_.SetEnabled(has_selection); | 202 remove_button_.SetEnabled(has_selection); |
| 201 // Reset the password related views. | 203 // Reset the password related views. |
| 202 show_button_.SetLabel( | 204 show_button_.SetLabel( |
| 203 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)); | 205 l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 columns.back().sortable = true; | 321 columns.back().sortable = true; |
| 320 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, | 322 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, |
| 321 true, true, true); | 323 true, true, true); |
| 322 // Make the table initially sorted by host. | 324 // Make the table initially sorted by host. |
| 323 views::TableView::SortDescriptors sort; | 325 views::TableView::SortDescriptors sort; |
| 324 sort.push_back(views::TableView::SortDescriptor( | 326 sort.push_back(views::TableView::SortDescriptor( |
| 325 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); | 327 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); |
| 326 table_view_->SetSortDescriptors(sort); | 328 table_view_->SetSortDescriptors(sort); |
| 327 table_view_->SetObserver(this); | 329 table_view_->SetObserver(this); |
| 328 } | 330 } |
| OLD | NEW |