| 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/i18n/rtl.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "chrome/browser/password_manager/password_store.h" | 10 #include "chrome/browser/password_manager/password_store.h" |
| 10 #include "chrome/browser/pref_service.h" | 11 #include "chrome/browser/pref_service.h" |
| 11 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 int PasswordsTableModel::RowCount() { | 65 int PasswordsTableModel::RowCount() { |
| 65 return static_cast<int>(saved_signons_.size()); | 66 return static_cast<int>(saved_signons_.size()); |
| 66 } | 67 } |
| 67 | 68 |
| 68 std::wstring PasswordsTableModel::GetText(int row, | 69 std::wstring PasswordsTableModel::GetText(int row, |
| 69 int col_id) { | 70 int col_id) { |
| 70 switch (col_id) { | 71 switch (col_id) { |
| 71 case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site. | 72 case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site. |
| 72 const std::wstring& url = saved_signons_[row]->display_url.display_url(); | 73 const std::wstring& url = saved_signons_[row]->display_url.display_url(); |
| 73 // Force URL to have LTR directionality. | 74 // Force URL to have LTR directionality. |
| 74 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { | 75 if (base::i18n::IsRTL()) { |
| 75 std::wstring localized_url = url; | 76 std::wstring localized_url = url; |
| 76 l10n_util::WrapStringWithLTRFormatting(&localized_url); | 77 base::i18n::WrapStringWithLTRFormatting(&localized_url); |
| 77 return localized_url; | 78 return localized_url; |
| 78 } | 79 } |
| 79 return url; | 80 return url; |
| 80 } | 81 } |
| 81 case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username. | 82 case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username. |
| 82 std::wstring username = GetPasswordFormAt(row)->username_value; | 83 std::wstring username = GetPasswordFormAt(row)->username_value; |
| 83 l10n_util::AdjustStringForLocaleDirection(username, &username); | 84 base::i18n::AdjustStringForLocaleDirection(username, &username); |
| 84 return username; | 85 return username; |
| 85 } | 86 } |
| 86 default: | 87 default: |
| 87 NOTREACHED() << "Invalid column."; | 88 NOTREACHED() << "Invalid column."; |
| 88 return std::wstring(); | 89 return std::wstring(); |
| 89 } | 90 } |
| 90 } | 91 } |
| 91 | 92 |
| 92 int PasswordsTableModel::CompareValues(int row1, int row2, | 93 int PasswordsTableModel::CompareValues(int row1, int row2, |
| 93 int column_id) { | 94 int column_id) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 columns.back().sortable = true; | 336 columns.back().sortable = true; |
| 336 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, | 337 table_view_ = new views::TableView(&table_model_, columns, views::TEXT_ONLY, |
| 337 true, true, true); | 338 true, true, true); |
| 338 // Make the table initially sorted by host. | 339 // Make the table initially sorted by host. |
| 339 views::TableView::SortDescriptors sort; | 340 views::TableView::SortDescriptors sort; |
| 340 sort.push_back(views::TableView::SortDescriptor( | 341 sort.push_back(views::TableView::SortDescriptor( |
| 341 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); | 342 IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN, true)); |
| 342 table_view_->SetSortDescriptors(sort); | 343 table_view_->SetSortDescriptors(sort); |
| 343 table_view_->SetObserver(this); | 344 table_view_->SetObserver(this); |
| 344 } | 345 } |
| OLD | NEW |