 Chromium Code Reviews
 Chromium Code Reviews Issue 6044007:
  Remove wstring from TableModel....  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/
    
  
    Issue 6044007:
  Remove wstring from TableModel....  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/i18n/rtl.h" | 
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" | 
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 63 } | 
| 64 | 64 | 
| 65 PasswordsTableModel::~PasswordsTableModel() { | 65 PasswordsTableModel::~PasswordsTableModel() { | 
| 66 CancelLoginsQuery(); | 66 CancelLoginsQuery(); | 
| 67 } | 67 } | 
| 68 | 68 | 
| 69 int PasswordsTableModel::RowCount() { | 69 int PasswordsTableModel::RowCount() { | 
| 70 return static_cast<int>(saved_signons_.size()); | 70 return static_cast<int>(saved_signons_.size()); | 
| 71 } | 71 } | 
| 72 | 72 | 
| 73 std::wstring PasswordsTableModel::GetText(int row, | 73 string16 PasswordsTableModel::GetText(int row, | 
| 74 int col_id) { | 74 int col_id) { | 
| 75 switch (col_id) { | 75 switch (col_id) { | 
| 76 case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site. | 76 case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site. | 
| 77 // Force URL to have LTR directionality. | 77 // Force URL to have LTR directionality. | 
| 78 std::wstring url(saved_signons_[row]->display_url.display_url()); | 78 std::wstring url(saved_signons_[row]->display_url.display_url()); | 
| 79 url = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( | 79 return base::i18n::GetDisplayStringInLTRDirectionality( | 
| 80 WideToUTF16(url))); | 80 WideToUTF16(url)); | 
| 
viettrungluu
2010/12/29 23:41:17
Should this be WideToUTF16Hack?
 
Avi (use Gerrit)
2010/12/30 00:04:15
Sure. In general the distinction between Hack and
 | |
| 81 return url; | |
| 82 } | 81 } | 
| 83 case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username. | 82 case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username. | 
| 84 std::wstring username = GetPasswordFormAt(row)->username_value; | 83 std::wstring username = GetPasswordFormAt(row)->username_value; | 
| 85 base::i18n::AdjustStringForLocaleDirection(&username); | 84 base::i18n::AdjustStringForLocaleDirection(&username); | 
| 86 return username; | 85 return WideToUTF16Hack(username); | 
| 87 } | 86 } | 
| 88 default: | 87 default: | 
| 89 NOTREACHED() << "Invalid column."; | 88 NOTREACHED() << "Invalid column."; | 
| 90 return std::wstring(); | 89 return string16(); | 
| 91 } | 90 } | 
| 92 } | 91 } | 
| 93 | 92 | 
| 94 int PasswordsTableModel::CompareValues(int row1, int row2, | 93 int PasswordsTableModel::CompareValues(int row1, int row2, | 
| 95 int column_id) { | 94 int column_id) { | 
| 96 if (column_id == IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN) { | 95 if (column_id == IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN) { | 
| 97 return saved_signons_[row1]->display_url.Compare( | 96 return saved_signons_[row1]->display_url.Compare( | 
| 98 saved_signons_[row2]->display_url, GetCollator()); | 97 saved_signons_[row2]->display_url, GetCollator()); | 
| 99 } | 98 } | 
| 100 return TableModel::CompareValues(row1, row2, column_id); | 99 return TableModel::CompareValues(row1, row2, column_id); | 
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 bool show = allow_show_passwords_.GetValue(); | 357 bool show = allow_show_passwords_.GetValue(); | 
| 359 if (!show) | 358 if (!show) | 
| 360 HidePassword(); | 359 HidePassword(); | 
| 361 show_button_.SetVisible(show); | 360 show_button_.SetVisible(show); | 
| 362 password_label_.SetVisible(show); | 361 password_label_.SetVisible(show); | 
| 363 // Update the layout (it may depend on the button size). | 362 // Update the layout (it may depend on the button size). | 
| 364 show_button_.InvalidateLayout(); | 363 show_button_.InvalidateLayout(); | 
| 365 Layout(); | 364 Layout(); | 
| 366 } | 365 } | 
| 367 } | 366 } | 
| OLD | NEW |