Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: views/controls/menu/menu_item_view.cc

Issue 6192007: Remove wstring from views. Part 3: Switch accessibility strings to string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/label_unittest.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/menus/menu_model.h" 8 #include "app/menus/menu_model.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "gfx/canvas.h" 10 #include "gfx/canvas.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 SubmenuView* MenuItemView::CreateSubmenu() { 301 SubmenuView* MenuItemView::CreateSubmenu() {
302 if (!submenu_) 302 if (!submenu_)
303 submenu_ = new SubmenuView(this); 303 submenu_ = new SubmenuView(this);
304 return submenu_; 304 return submenu_;
305 } 305 }
306 306
307 void MenuItemView::SetTitle(const std::wstring& title) { 307 void MenuItemView::SetTitle(const std::wstring& title) {
308 title_ = WideToUTF16Hack(title); 308 title_ = WideToUTF16Hack(title);
309 SetAccessibleName(UTF16ToWideHack( 309 SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText()));
310 GetAccessibleNameForMenuItem(title_, GetAcceleratorText())));
311 } 310 }
312 311
313 void MenuItemView::SetSelected(bool selected) { 312 void MenuItemView::SetSelected(bool selected) {
314 selected_ = selected; 313 selected_ = selected;
315 SchedulePaint(); 314 SchedulePaint();
316 } 315 }
317 316
318 void MenuItemView::SetTooltip(const std::wstring& tooltip, int item_id) { 317 void MenuItemView::SetTooltip(const std::wstring& tooltip, int item_id) {
319 MenuItemView* item = GetMenuItemByID(item_id); 318 MenuItemView* item = GetMenuItemByID(item_id);
320 DCHECK(item); 319 DCHECK(item);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 657 }
659 658
660 string16 MenuItemView::GetAcceleratorText() { 659 string16 MenuItemView::GetAcceleratorText() {
661 Accelerator accelerator; 660 Accelerator accelerator;
662 return (GetDelegate() && 661 return (GetDelegate() &&
663 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? 662 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?
664 accelerator.GetShortcutText() : string16(); 663 accelerator.GetShortcutText() : string16();
665 } 664 }
666 665
667 } // namespace views 666 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/label_unittest.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698