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_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/os_exchange_data.h" | 9 #include "app/os_exchange_data.h" |
| 10 #include "base/i18n/rtl.h" |
10 #include "base/keyboard_codes.h" | 11 #include "base/keyboard_codes.h" |
11 #include "base/time.h" | 12 #include "base/time.h" |
12 #include "views/controls/button/menu_button.h" | 13 #include "views/controls/button/menu_button.h" |
13 #include "views/controls/menu/menu_scroll_view_container.h" | 14 #include "views/controls/menu/menu_scroll_view_container.h" |
14 #include "views/controls/menu/submenu_view.h" | 15 #include "views/controls/menu/submenu_view.h" |
15 #include "views/drag_utils.h" | 16 #include "views/drag_utils.h" |
16 #include "views/screen.h" | 17 #include "views/screen.h" |
17 #include "views/view_constants.h" | 18 #include "views/view_constants.h" |
18 #include "views/widget/root_view.h" | 19 #include "views/widget/root_view.h" |
19 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 IncrementSelection(-1); | 724 IncrementSelection(-1); |
724 break; | 725 break; |
725 | 726 |
726 case base::VKEY_DOWN: | 727 case base::VKEY_DOWN: |
727 IncrementSelection(1); | 728 IncrementSelection(1); |
728 break; | 729 break; |
729 | 730 |
730 // Handling of VK_RIGHT and VK_LEFT is different depending on the UI | 731 // Handling of VK_RIGHT and VK_LEFT is different depending on the UI |
731 // layout. | 732 // layout. |
732 case base::VKEY_RIGHT: | 733 case base::VKEY_RIGHT: |
733 if (l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT) | 734 if (base::i18n::IsRTL()) |
734 CloseSubmenu(); | 735 CloseSubmenu(); |
735 else | 736 else |
736 OpenSubmenuChangeSelectionIfCan(); | 737 OpenSubmenuChangeSelectionIfCan(); |
737 break; | 738 break; |
738 | 739 |
739 case base::VKEY_LEFT: | 740 case base::VKEY_LEFT: |
740 if (l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT) | 741 if (base::i18n::IsRTL()) |
741 OpenSubmenuChangeSelectionIfCan(); | 742 OpenSubmenuChangeSelectionIfCan(); |
742 else | 743 else |
743 CloseSubmenu(); | 744 CloseSubmenu(); |
744 break; | 745 break; |
745 | 746 |
746 case base::VKEY_RETURN: | 747 case base::VKEY_RETURN: |
747 if (pending_state_.item) { | 748 if (pending_state_.item) { |
748 if (pending_state_.item->HasSubmenu()) { | 749 if (pending_state_.item->HasSubmenu()) { |
749 OpenSubmenuChangeSelectionIfCan(); | 750 OpenSubmenuChangeSelectionIfCan(); |
750 } else if (pending_state_.item->IsEnabled()) { | 751 } else if (pending_state_.item->IsEnabled()) { |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 if (!scroll_task_.get()) | 1496 if (!scroll_task_.get()) |
1496 scroll_task_.reset(new MenuScrollTask()); | 1497 scroll_task_.reset(new MenuScrollTask()); |
1497 scroll_task_->Update(part); | 1498 scroll_task_->Update(part); |
1498 } | 1499 } |
1499 | 1500 |
1500 void MenuController::StopScrolling() { | 1501 void MenuController::StopScrolling() { |
1501 scroll_task_.reset(NULL); | 1502 scroll_task_.reset(NULL); |
1502 } | 1503 } |
1503 | 1504 |
1504 } // namespace views | 1505 } // namespace views |
OLD | NEW |