| 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 "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 "base/utf_string_conversions.h" |
| 8 #include "gfx/canvas.h" | 9 #include "gfx/canvas.h" |
| 9 #include "grit/app_strings.h" | 10 #include "grit/app_strings.h" |
| 10 #include "views/controls/button/text_button.h" | 11 #include "views/controls/button/text_button.h" |
| 11 #include "views/controls/button/menu_button.h" | 12 #include "views/controls/button/menu_button.h" |
| 12 #include "views/controls/menu/menu_config.h" | 13 #include "views/controls/menu/menu_config.h" |
| 13 #include "views/controls/menu/menu_controller.h" | 14 #include "views/controls/menu/menu_controller.h" |
| 14 #include "views/controls/menu/menu_separator.h" | 15 #include "views/controls/menu/menu_separator.h" |
| 15 #include "views/controls/menu/submenu_view.h" | 16 #include "views/controls/menu/submenu_view.h" |
| 16 | 17 |
| 17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 if (!GetRootMenuItem()->has_mnemonics_) | 310 if (!GetRootMenuItem()->has_mnemonics_) |
| 310 return 0; | 311 return 0; |
| 311 | 312 |
| 312 const std::wstring& title = GetTitle(); | 313 const std::wstring& title = GetTitle(); |
| 313 size_t index = 0; | 314 size_t index = 0; |
| 314 do { | 315 do { |
| 315 index = title.find('&', index); | 316 index = title.find('&', index); |
| 316 if (index != std::wstring::npos) { | 317 if (index != std::wstring::npos) { |
| 317 if (index + 1 != title.size() && title[index + 1] != '&') { | 318 if (index + 1 != title.size() && title[index + 1] != '&') { |
| 318 wchar_t char_array[1] = { title[index + 1] }; | 319 wchar_t char_array[1] = { title[index + 1] }; |
| 319 return l10n_util::ToLower(char_array)[0]; | 320 return UTF16ToWide(l10n_util::ToLower(WideToUTF16(char_array)))[0]; |
| 320 } | 321 } |
| 321 index++; | 322 index++; |
| 322 } | 323 } |
| 323 } while (index != std::wstring::npos); | 324 } while (index != std::wstring::npos); |
| 324 return 0; | 325 return 0; |
| 325 } | 326 } |
| 326 | 327 |
| 327 MenuItemView* MenuItemView::GetMenuItemByID(int id) { | 328 MenuItemView* MenuItemView::GetMenuItemByID(int id) { |
| 328 if (GetCommand() == id) | 329 if (GetCommand() == id) |
| 329 return this; | 330 return this; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 604 } |
| 604 | 605 |
| 605 std::wstring MenuItemView::GetAcceleratorText() { | 606 std::wstring MenuItemView::GetAcceleratorText() { |
| 606 Accelerator accelerator; | 607 Accelerator accelerator; |
| 607 return (GetDelegate() && | 608 return (GetDelegate() && |
| 608 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 609 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
| 609 accelerator.GetShortcutText() : std::wstring(); | 610 accelerator.GetShortcutText() : std::wstring(); |
| 610 } | 611 } |
| 611 | 612 |
| 612 } // namespace views | 613 } // namespace views |
| OLD | NEW |