| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/common/l10n_util.h" | 6 #include "chrome/common/l10n_util.h" |
| 7 #include "chrome/browser/profile.h" | 7 #include "chrome/browser/profile.h" |
| 8 #include "chrome/browser/views/password_manager_view.h" | 8 #include "chrome/browser/views/password_manager_view.h" |
| 9 #include "chrome/browser/views/standard_layout.h" | 9 #include "chrome/browser/views/standard_layout.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 CancelLoginsQuery(); | 66 CancelLoginsQuery(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 int PasswordManagerTableModel::RowCount() { | 69 int PasswordManagerTableModel::RowCount() { |
| 70 return static_cast<int>(saved_signons_.size()); | 70 return static_cast<int>(saved_signons_.size()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 std::wstring PasswordManagerTableModel::GetText(int row, | 73 std::wstring PasswordManagerTableModel::GetText(int row, |
| 74 int col_id) { | 74 int col_id) { |
| 75 switch (col_id) { | 75 switch (col_id) { |
| 76 case IDS_PASSWORD_MANAGER_VIEW_SITE_COLUMN: // Site. | 76 case IDS_PASSWORD_MANAGER_VIEW_SITE_COLUMN: { // Site. |
| 77 return saved_signons_[row]->display_url.display_url(); | 77 const std::wstring& url = saved_signons_[row]->display_url.display_url(); |
| 78 case IDS_PASSWORD_MANAGER_VIEW_USERNAME_COLUMN: // Username. | 78 // Force URL to have LTR directionality. |
| 79 return GetPasswordFormAt(row)->username_value; | 79 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { |
| 80 std::wstring localized_url = url; |
| 81 l10n_util::WrapStringWithLTRFormatting(&localized_url); |
| 82 return localized_url; |
| 83 } |
| 84 return url; |
| 85 } |
| 86 case IDS_PASSWORD_MANAGER_VIEW_USERNAME_COLUMN: { // Username. |
| 87 std::wstring username = GetPasswordFormAt(row)->username_value; |
| 88 l10n_util::AdjustStringForLocaleDirection(username, &username); |
| 89 return username; |
| 90 } |
| 80 default: | 91 default: |
| 81 NOTREACHED() << "Invalid column."; | 92 NOTREACHED() << "Invalid column."; |
| 82 return std::wstring(); | 93 return std::wstring(); |
| 83 } | 94 } |
| 84 } | 95 } |
| 85 | 96 |
| 86 int PasswordManagerTableModel::CompareValues(int row1, int row2, | 97 int PasswordManagerTableModel::CompareValues(int row1, int row2, |
| 87 int column_id) { | 98 int column_id) { |
| 88 if (column_id == IDS_PASSWORD_MANAGER_VIEW_SITE_COLUMN) { | 99 if (column_id == IDS_PASSWORD_MANAGER_VIEW_SITE_COLUMN) { |
| 89 return saved_signons_[row1]->display_url.Compare( | 100 return saved_signons_[row1]->display_url.Compare( |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 table_view_->SetModel(NULL); | 393 table_view_->SetModel(NULL); |
| 383 | 394 |
| 384 // Clear the static instance so the next time Show() is called, a new | 395 // Clear the static instance so the next time Show() is called, a new |
| 385 // instance is created. | 396 // instance is created. |
| 386 instance_ = NULL; | 397 instance_ = NULL; |
| 387 } | 398 } |
| 388 | 399 |
| 389 views::View* PasswordManagerView::GetContentsView() { | 400 views::View* PasswordManagerView::GetContentsView() { |
| 390 return this; | 401 return this; |
| 391 } | 402 } |
| OLD | NEW |