| Index: ui/views/controls/menu/menu_item_view.cc
|
| diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
|
| index 8e3013b119756ffaab50866279c442f003116da6..930ca1efe1b01cba67577197a5d9c01af15901c5 100644
|
| --- a/ui/views/controls/menu/menu_item_view.cc
|
| +++ b/ui/views/controls/menu/menu_item_view.cc
|
| @@ -112,7 +112,8 @@ MenuItemView::MenuItemView(MenuDelegate* delegate)
|
| right_icon_margin_(0),
|
| requested_menu_position_(POSITION_BEST_FIT),
|
| actual_menu_position_(requested_menu_position_),
|
| - use_right_margin_(true) {
|
| + use_right_margin_(true),
|
| + hot_button_(nullptr) {
|
| // NOTE: don't check the delegate for NULL, UpdateMenuPartSizes() supplies a
|
| // NULL delegate.
|
| Init(NULL, 0, SUBMENU, delegate);
|
| @@ -366,6 +367,8 @@ void MenuItemView::SetMinorText(const base::string16& minor_text) {
|
|
|
| void MenuItemView::SetSelected(bool selected) {
|
| selected_ = selected;
|
| + if (!selected_)
|
| + SetHotTrackedButton(nullptr);
|
| SchedulePaint();
|
| }
|
|
|
| @@ -565,6 +568,20 @@ void MenuItemView::Layout() {
|
| }
|
| }
|
|
|
| +void MenuItemView::SetHotTrackedButton(CustomButton* hot_button) {
|
| + if (hot_button == hot_button_) {
|
| + // Hot-tracked state may change outside of the MenuController. Correct it.
|
| + if (hot_button && !hot_button->IsHotTracked())
|
| + hot_button->SetHotTracked(true);
|
| + return;
|
| + }
|
| + if (hot_button_)
|
| + hot_button_->SetHotTracked(false);
|
| + hot_button_ = hot_button;
|
| + if (hot_button)
|
| + hot_button->SetHotTracked(true);
|
| +}
|
| +
|
| void MenuItemView::SetMargins(int top_margin, int bottom_margin) {
|
| top_margin_ = top_margin;
|
| bottom_margin_ = bottom_margin;
|
| @@ -593,7 +610,8 @@ MenuItemView::MenuItemView(MenuItemView* parent,
|
| right_icon_margin_(0),
|
| requested_menu_position_(POSITION_BEST_FIT),
|
| actual_menu_position_(requested_menu_position_),
|
| - use_right_margin_(true) {
|
| + use_right_margin_(true),
|
| + hot_button_(nullptr) {
|
| Init(parent, command, type, NULL);
|
| }
|
|
|
| @@ -606,6 +624,15 @@ const char* MenuItemView::GetClassName() const {
|
| return kViewClassName;
|
| }
|
|
|
| +void MenuItemView::ViewHierarchyChanged(
|
| + const ViewHierarchyChangedDetails& details) {
|
| + if (!details.is_add) {
|
| + // Update |hot_button_| if it gets removed while a menu is up.
|
| + if (details.child == hot_button_)
|
| + hot_button_ = nullptr;
|
| + }
|
| +}
|
| +
|
| // Calculates all sizes that we can from the OS.
|
| //
|
| // This is invoked prior to Running a menu.
|
|
|