diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-22 16:49:37 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-22 16:49:37 +0000 |
commit | a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2 (patch) | |
tree | e05c5e6959584c84cef55647d9bf1e4bbb2217d9 /views | |
parent | e7afe2458ed03e907601cd3c05dc5f253f824d88 (diff) | |
download | chromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.zip chromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.tar.gz chromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.tar.bz2 |
Remove wstrings from bookmarks, part 12.
- This changes RecentlyUsedFoldersComboModel::GetItemAt() to return a string16
instead of a wstring.
- This entailed changing the base class, ComboboxModel, and shaving a herd of
yaks.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3159031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/combobox/combobox.cc | 3 | ||||
-rw-r--r-- | views/controls/combobox/native_combobox_gtk.cc | 2 | ||||
-rw-r--r-- | views/controls/combobox/native_combobox_win.cc | 3 | ||||
-rw-r--r-- | views/examples/combobox_example.h | 10 | ||||
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 11 |
5 files changed, 17 insertions, 12 deletions
diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index e213bdc..0c24a0d 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -7,6 +7,7 @@ #include "app/combobox_model.h" #include "base/keyboard_codes.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "views/controls/combobox/native_combobox_wrapper.h" #include "views/controls/native/native_view_host.h" @@ -96,7 +97,7 @@ bool Combobox::GetAccessibleRole(AccessibilityTypes::Role* role) { bool Combobox::GetAccessibleValue(std::wstring* value) { DCHECK(value); - *value = model_->GetItemAt(selected_item_); + *value = UTF16ToWideHack(model_->GetItemAt(selected_item_)); return true; } diff --git a/views/controls/combobox/native_combobox_gtk.cc b/views/controls/combobox/native_combobox_gtk.cc index 61e187a..f756171 100644 --- a/views/controls/combobox/native_combobox_gtk.cc +++ b/views/controls/combobox/native_combobox_gtk.cc @@ -44,7 +44,7 @@ void NativeComboboxGtk::UpdateFromModel() { while (count-- > 0) { gtk_list_store_prepend(store, &iter); gtk_list_store_set(store, &iter, - 0, WideToUTF8(model->GetItemAt(count)).c_str(), + 0, UTF16ToUTF8(model->GetItemAt(count)).c_str(), -1); } } diff --git a/views/controls/combobox/native_combobox_win.cc b/views/controls/combobox/native_combobox_win.cc index b1bc88f..720e51f 100644 --- a/views/controls/combobox/native_combobox_win.cc +++ b/views/controls/combobox/native_combobox_win.cc @@ -7,6 +7,7 @@ #include "app/combobox_model.h" #include "app/resource_bundle.h" #include "base/i18n/rtl.h" +#include "base/utf_string_conversions.h" #include "gfx/font.h" #include "gfx/native_theme_win.h" #include "views/controls/combobox/combobox.h" @@ -46,7 +47,7 @@ void NativeComboboxWin::UpdateFromModel() { int max_width = 0; int num_items = combobox_->model()->GetItemCount(); for (int i = 0; i < num_items; ++i) { - const std::wstring& text = combobox_->model()->GetItemAt(i); + const std::wstring& text = UTF16ToWide(combobox_->model()->GetItemAt(i)); // Inserting the Unicode formatting characters if necessary so that the // text is displayed correctly in right-to-left UIs. diff --git a/views/examples/combobox_example.h b/views/examples/combobox_example.h index d756eb5..3aad6eb 100644 --- a/views/examples/combobox_example.h +++ b/views/examples/combobox_example.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "app/combobox_model.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "views/controls/combobox/combobox.h" #include "views/examples/example_base.h" #include "views/fill_layout.h" @@ -44,8 +45,8 @@ class ComboboxExample : public ExampleBase, public views::Combobox::Listener { return 10; } - virtual std::wstring GetItemAt(int index) { - return StringPrintf(L"Item %d", index); + virtual string16 GetItemAt(int index) { + return WideToUTF16Hack(StringPrintf(L"Item %d", index)); } private: @@ -57,7 +58,8 @@ class ComboboxExample : public ExampleBase, public views::Combobox::Listener { int prev_index, int new_index) { PrintStatus(L"Selected: index=%d, label=%ls", - new_index, combo_box->model()->GetItemAt(new_index).c_str()); + new_index, UTF16ToWideHack( + combo_box->model()->GetItemAt(new_index)).c_str()); } // This test only control. diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index f786b1d..a711538 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "app/combobox_model.h" #include "base/keyboard_codes.h" #include "base/logging.h" +#include "base/string16.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "gfx/rect.h" @@ -322,8 +323,8 @@ class DummyComboboxModel : public ComboboxModel { public: virtual int GetItemCount() { return 10; } - virtual std::wstring GetItemAt(int index) { - return L"Item " + UTF16ToWideHack(base::IntToString16(index)); + virtual string16 GetItemAt(int index) { + return ASCIIToUTF16("Item ") + base::IntToString16(index); } }; @@ -907,8 +908,8 @@ class TestCombobox : public Combobox, public ComboboxModel { virtual int GetItemCount() { return 10; } - virtual std::wstring GetItemAt(int index) { - return L"Hello combo"; + virtual string16 GetItemAt(int index) { + return ASCIIToUTF16("Hello combo"); } }; |