| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 int PasswordsTableModel::CompareValues(int row1, int row2, | 90 int PasswordsTableModel::CompareValues(int row1, int row2, |
| 91 int column_id) { | 91 int column_id) { |
| 92 if (column_id == IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN) { | 92 if (column_id == IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN) { |
| 93 return saved_signons_[row1]->display_url.Compare( | 93 return saved_signons_[row1]->display_url.Compare( |
| 94 saved_signons_[row2]->display_url, GetCollator()); | 94 saved_signons_[row2]->display_url, GetCollator()); |
| 95 } | 95 } |
| 96 return TableModel::CompareValues(row1, row2, column_id); | 96 return TableModel::CompareValues(row1, row2, column_id); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void PasswordsTableModel::SetObserver( | 99 void PasswordsTableModel::SetObserver(TableModelObserver* observer) { |
| 100 views::TableModelObserver* observer) { | |
| 101 observer_ = observer; | 100 observer_ = observer; |
| 102 } | 101 } |
| 103 | 102 |
| 104 void PasswordsTableModel::GetAllSavedLoginsForProfile() { | 103 void PasswordsTableModel::GetAllSavedLoginsForProfile() { |
| 105 DCHECK(!pending_login_query_); | 104 DCHECK(!pending_login_query_); |
| 106 pending_login_query_ = web_data_service()->GetAllAutofillableLogins(this); | 105 pending_login_query_ = web_data_service()->GetAllAutofillableLogins(this); |
| 107 } | 106 } |
| 108 | 107 |
| 109 void PasswordsTableModel::OnWebDataServiceRequestDone( | 108 void PasswordsTableModel::OnWebDataServiceRequestDone( |
| 110 WebDataService::Handle h, | 109 WebDataService::Handle h, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 297 |
| 299 password_label_.SetParentOwned(false); | 298 password_label_.SetParentOwned(false); |
| 300 } | 299 } |
| 301 | 300 |
| 302 void PasswordsPageView::SetupTable() { | 301 void PasswordsPageView::SetupTable() { |
| 303 // Tell the table model we are concern about how many rows it has. | 302 // Tell the table model we are concern about how many rows it has. |
| 304 table_model_.set_row_count_observer(this); | 303 table_model_.set_row_count_observer(this); |
| 305 | 304 |
| 306 // Creates the different columns for the table. | 305 // Creates the different columns for the table. |
| 307 // The float resize values are the result of much tinkering. | 306 // The float resize values are the result of much tinkering. |
| 308 std::vector<views::TableColumn> columns; | 307 std::vector<TableColumn> columns; |
| 309 columns.push_back(views::TableColumn(IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, | 308 columns.push_back(TableColumn(IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, |
| 310 views::TableColumn::LEFT, -1, 0.55f)); | 309 TableColumn::LEFT, -1, 0.55f)); |
| 311 columns.back().sortable = true; | 310 columns.back().sortable = true; |
| 312 columns.push_back(views::TableColumn( | 311 columns.push_back(TableColumn( |
| 313 IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN, views::TableColumn::LEFT, | 312 IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN, TableColumn::LEFT, |
| 314 -1, 0.37f)); | 313 -1, 0.37f)); |
| 315 columns.back().sortable = true; | 314 columns.back().sortable = true; |
| 316 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, | 315 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, |
| 317 true, true, true); | 316 true, true, true); |
| 318 // Make the table initially sorted by host. | 317 // Make the table initially sorted by host. |
| 319 views::TableView::SortDescriptors sort; | 318 views::TableView::SortDescriptors sort; |
| 320 sort.push_back(views::TableView::SortDescriptor( | 319 sort.push_back(views::TableView::SortDescriptor( |
| 321 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); | 320 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); |
| 322 table_view_->SetSortDescriptors(sort); | 321 table_view_->SetSortDescriptors(sort); |
| 323 table_view_->SetObserver(this); | 322 table_view_->SetObserver(this); |
| 324 } | 323 } |
| OLD | NEW |