diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 20:16:00 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 20:16:00 +0000 |
commit | e5a4f651a1fc80f7c91973ec2be95870a997c9ac (patch) | |
tree | d0fde811d0456945b7dfe6f70c8ab5b6818795a0 /views | |
parent | 9bf6261c9c8f6cf72b6b494588044d0a927ee899 (diff) | |
download | chromium_src-e5a4f651a1fc80f7c91973ec2be95870a997c9ac.zip chromium_src-e5a4f651a1fc80f7c91973ec2be95870a997c9ac.tar.gz chromium_src-e5a4f651a1fc80f7c91973ec2be95870a997c9ac.tar.bz2 |
views: Change from wstring to string16 in controls/ directory.
BUG=68267
R=sky@chromium.org
Review URL: http://codereview.chromium.org/8360008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 25 | ||||
-rw-r--r-- | views/controls/menu/native_menu_win.h | 6 | ||||
-rw-r--r-- | views/controls/table/native_table_win.cc | 2 | ||||
-rw-r--r-- | views/controls/table/table_view.cc | 4 | ||||
-rw-r--r-- | views/controls/table/table_view.h | 3 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 13 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.h | 3 |
7 files changed, 28 insertions, 28 deletions
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index 891326f..99094ae 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -48,7 +48,7 @@ struct NativeMenuWin::ItemData { // The Windows API requires that whoever creates the menus must own the // strings used for labels, and keep them around for the lifetime of the // created menu. So be it. - std::wstring label; + string16 label; // Someone needs to own submenus, it may as well be us. scoped_ptr<Menu2> submenu; @@ -168,7 +168,7 @@ class NativeMenuWin::MenuHostWindow { if (data->submenu.get()) measure_item_struct->itemWidth += kArrowWidth; // If the label contains an accelerator, make room for tab. - if (data->label.find(L'\t') != std::wstring::npos) + if (data->label.find(L'\t') != string16::npos) measure_item_struct->itemWidth += font.GetStringWidth(L" "); measure_item_struct->itemHeight = font.GetHeight() + kItemBottomMargin + kItemTopMargin; @@ -224,10 +224,10 @@ class NativeMenuWin::MenuHostWindow { // left and the accelerator on the right. // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the // window system UI font and will not hit here. - std::wstring label = data->label; - std::wstring accel; - std::wstring::size_type tab_pos = label.find(L'\t'); - if (tab_pos != std::wstring::npos) { + string16 label = data->label; + string16 accel; + string16::size_type tab_pos = label.find(L'\t'); + if (tab_pos != string16::npos) { accel = label.substr(tab_pos); label = label.substr(0, tab_pos); } @@ -612,7 +612,7 @@ void NativeMenuWin::AddMenuItemAt(int menu_index, int model_index) { mii.fType = MFT_OWNERDRAW; ItemData* item_data = new ItemData; - item_data->label = std::wstring(); + item_data->label = string16(); ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); if (type == ui::MenuModel::TYPE_SUBMENU) { item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index))); @@ -664,7 +664,7 @@ void NativeMenuWin::SetMenuItemState(int menu_index, bool enabled, bool checked, void NativeMenuWin::SetMenuItemLabel(int menu_index, int model_index, - const std::wstring& label) { + const string16& label) { if (IsSeparatorItemAt(menu_index)) return; @@ -674,11 +674,10 @@ void NativeMenuWin::SetMenuItemLabel(int menu_index, SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii); } -void NativeMenuWin::UpdateMenuItemInfoForString( - MENUITEMINFO* mii, - int model_index, - const std::wstring& label) { - std::wstring formatted = label; +void NativeMenuWin::UpdateMenuItemInfoForString(MENUITEMINFO* mii, + int model_index, + const string16& label) { + string16 formatted = label; ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); // Strip out any tabs, otherwise they get interpreted as accelerators and can // lead to weird behavior. diff --git a/views/controls/menu/native_menu_win.h b/views/controls/menu/native_menu_win.h index 6f32505..edba40c 100644 --- a/views/controls/menu/native_menu_win.h +++ b/views/controls/menu/native_menu_win.h @@ -10,8 +10,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/memory/weak_ptr.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "ui/base/models/simple_menu_model.h" #include "views/controls/menu/menu_wrapper.h" @@ -71,7 +71,7 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper { // Sets the label of the item at the specified index. void SetMenuItemLabel(int menu_index, int model_index, - const std::wstring& label); + const string16& label); // Updates the local data structure with the correctly formatted version of // |label| at the specified model_index, and adds string data to |mii| if @@ -79,7 +79,7 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper { // of the peculiarities of the Windows menu API. void UpdateMenuItemInfoForString(MENUITEMINFO* mii, int model_index, - const std::wstring& label); + const string16& label); // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the // supplied alignment and the UI text direction. diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc index 91d46c9..94bc54d 100644 --- a/views/controls/table/native_table_win.cc +++ b/views/controls/table/native_table_win.cc @@ -594,7 +594,7 @@ void NativeTableWin::UpdateListViewCache(int start, int length, bool add) { for (int i = start; i < max_row; ++i) { item.iItem = i; item.iSubItem = j; - std::wstring text = table_->model()->GetText(i, col.id); + string16 text = table_->model()->GetText(i, col.id); item.pszText = const_cast<LPWSTR>(text.c_str()); item.iImage = 0; ListView_SetItem(native_view(), &item); diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 5ee978c..987ca40 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -1397,7 +1397,7 @@ int TableView::ViewToModel(int view_index) const { return view_to_model_[view_index]; } -void TableView::SetAltText(const std::wstring& alt_text) { +void TableView::SetAltText(const string16& alt_text) { if (alt_text == alt_text_) return; @@ -1445,7 +1445,7 @@ void TableView::UpdateListViewCache0(int start, int length, bool add) { // Set item. item.iItem = add ? i : ModelToView(i); item.iSubItem = j; - std::wstring text = model_->GetText(i, visible_columns_[j]); + string16 text = model_->GetText(i, visible_columns_[j]); item.pszText = const_cast<LPWSTR>(text.c_str()); ListView_SetItem(list_view_, &item); diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h index ea26d95..c469999 100644 --- a/views/controls/table/table_view.h +++ b/views/controls/table/table_view.h @@ -10,6 +10,7 @@ #include <vector> #include "base/gtest_prod_util.h" +#include "base/string16.h" #include "build/build_config.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -236,7 +237,7 @@ class VIEWS_EXPORT TableView : public NativeControl, // Sets the text to display on top of the table. This is useful if the table // is empty and you want to inform the user why. - void SetAltText(const std::wstring& alt_text); + void SetAltText(const string16& alt_text); protected: // Overriden to return the position of the first selected row. diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 6001674..c49f76d 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -173,7 +173,7 @@ void NativeTextfieldWin::AttachHack() { string16 NativeTextfieldWin::GetText() const { int len = GetTextLength() + 1; - std::wstring str; + string16 str; GetWindowText(WriteInto(&str, len), len); // The text get from GetWindowText() might be wrapped with explicit bidi // control characters. Refer to UpdateText() for detail. Without such @@ -495,7 +495,7 @@ void NativeTextfieldWin::UpdateAccessibleState(uint32 state_flag, CHILDID_SELF); } -void NativeTextfieldWin::UpdateAccessibleValue(const std::wstring& value) { +void NativeTextfieldWin::UpdateAccessibleValue(const string16& value) { base::win::ScopedComPtr<IAccPropServices> pAccPropServices; HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); @@ -530,8 +530,7 @@ void NativeTextfieldWin::OnCopy() { if (textfield_->IsPassword()) return; - const std::wstring text(GetSelectedText()); - + const string16 text(GetSelectedText()); if (!text.empty() && ViewsDelegate::views_delegate) { ui::ScopedClipboardWriter scw( ViewsDelegate::views_delegate->GetClipboard()); @@ -918,7 +917,7 @@ void NativeTextfieldWin::OnPaste() { ui::Clipboard::BUFFER_STANDARD)) return; - std::wstring clipboard_str; + string16 clipboard_str; clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_str); if (!clipboard_str.empty()) { string16 collapsed(CollapseWhitespace(clipboard_str, false)); @@ -1022,7 +1021,7 @@ void NativeTextfieldWin::OnAfterPossibleChange(bool should_redraw_text) { SetSel(new_sel); } - std::wstring new_text(GetText()); + string16 new_text(GetText()); if (new_text != text_before_change_) { if (ime_discard_composition_ && ime_composition_start_ >= 0 && ime_composition_length_ > 0) { @@ -1041,7 +1040,7 @@ void NativeTextfieldWin::OnAfterPossibleChange(bool should_redraw_text) { if (should_redraw_text) { CHARRANGE original_sel; GetSel(original_sel); - std::wstring text = GetText(); + string16 text(GetText()); ScopedSuspendUndo suspend_undo(GetTextObjectModel()); SelectAll(); diff --git a/views/controls/textfield/native_textfield_win.h b/views/controls/textfield/native_textfield_win.h index 7c4880b..bb8cb96 100644 --- a/views/controls/textfield/native_textfield_win.h +++ b/views/controls/textfield/native_textfield_win.h @@ -15,6 +15,7 @@ #include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl #include <vsstyle.h> +#include "base/string16.h" #include "base/win/scoped_comptr.h" #include "ui/base/models/simple_menu_model.h" #include "ui/gfx/insets.h" @@ -107,7 +108,7 @@ class NativeTextfieldWin // Update accessibility information. void InitializeAccessibilityInfo(); void UpdateAccessibleState(uint32 state_flag, bool set_value); - void UpdateAccessibleValue(const std::wstring& value); + void UpdateAccessibleValue(const string16& value); // CWindowImpl BEGIN_MSG_MAP(Edit) |