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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 2684993009: Stop MenuItemView From Directly Caching MenuController (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller_unittest.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) 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
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_ = this; 1557 alt_menu->controller_ = AsWeakPtr();
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698