| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 | 1547 |
| 1548 // It is currently not possible to show a submenu recursively in a bubble. | 1548 // It is currently not possible to show a submenu recursively in a bubble. |
| 1549 DCHECK(!MenuItemView::IsBubble(anchor)); | 1549 DCHECK(!MenuItemView::IsBubble(anchor)); |
| 1550 // Subtract 1 from the height to make the popup flush with the button border. | 1550 // Subtract 1 from the height to make the popup flush with the button border. |
| 1551 UpdateInitialLocation(gfx::Rect(screen_menu_loc.x(), screen_menu_loc.y(), | 1551 UpdateInitialLocation(gfx::Rect(screen_menu_loc.x(), screen_menu_loc.y(), |
| 1552 button->width(), button->height() - 1), | 1552 button->width(), button->height() - 1), |
| 1553 anchor, state_.context_menu); | 1553 anchor, state_.context_menu); |
| 1554 alt_menu->PrepareForRun( | 1554 alt_menu->PrepareForRun( |
| 1555 false, has_mnemonics, | 1555 false, has_mnemonics, |
| 1556 source->GetMenuItem()->GetRootMenuItem()->show_mnemonics_); | 1556 source->GetMenuItem()->GetRootMenuItem()->show_mnemonics_); |
| 1557 alt_menu->controller_ = AsWeakPtr(); | 1557 alt_menu->controller_ = this; |
| 1558 SetSelection(alt_menu, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); | 1558 SetSelection(alt_menu, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); |
| 1559 return true; | 1559 return true; |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 bool MenuController::ShowContextMenu(MenuItemView* menu_item, | 1562 bool MenuController::ShowContextMenu(MenuItemView* menu_item, |
| 1563 const gfx::Point& screen_location, | 1563 const gfx::Point& screen_location, |
| 1564 ui::MenuSourceType source_type) { | 1564 ui::MenuSourceType source_type) { |
| 1565 // Set the selection immediately, making sure the submenu is only open | 1565 // Set the selection immediately, making sure the submenu is only open |
| 1566 // if it already was. | 1566 // if it already was. |
| 1567 int selection_types = SELECTION_UPDATE_IMMEDIATELY; | 1567 int selection_types = SELECTION_UPDATE_IMMEDIATELY; |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 if (hot_button_) | 2750 if (hot_button_) |
| 2751 hot_button_->SetHotTracked(false); | 2751 hot_button_->SetHotTracked(false); |
| 2752 hot_button_ = hot_button; | 2752 hot_button_ = hot_button; |
| 2753 if (hot_button) { | 2753 if (hot_button) { |
| 2754 hot_button->SetHotTracked(true); | 2754 hot_button->SetHotTracked(true); |
| 2755 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); | 2755 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); |
| 2756 } | 2756 } |
| 2757 } | 2757 } |
| 2758 | 2758 |
| 2759 } // namespace views | 2759 } // namespace views |
| OLD | NEW |