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

Unified Diff: ui/views/controls/button/button_dropdown.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/button_dropdown.h ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/button_dropdown.cc
diff --git a/ui/views/controls/button/button_dropdown.cc b/ui/views/controls/button/button_dropdown.cc
index a243cee1917c4a0aa01e377bdf9d168218f1a012..fa57e3b1e9abb020cc83f9ee753523ce2c4a78fe 100644
--- a/ui/views/controls/button/button_dropdown.cc
+++ b/ui/views/controls/button/button_dropdown.cc
@@ -70,7 +70,8 @@ bool ButtonDropDown::OnMousePressed(const ui::MouseEvent& event) {
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&ButtonDropDown::ShowDropDownMenu,
- show_menu_factory_.GetWeakPtr()),
+ show_menu_factory_.GetWeakPtr(),
+ ui::GetMenuSourceTypeForEvent(event)),
base::TimeDelta::FromMilliseconds(kMenuTimerDelay));
}
return ImageButton::OnMousePressed(event);
@@ -85,7 +86,7 @@ bool ButtonDropDown::OnMouseDragged(const ui::MouseEvent& event) {
// it immediately.
if (event.y() > y_position_on_lbuttondown_ + GetHorizontalDragThreshold()) {
show_menu_factory_.InvalidateWeakPtrs();
- ShowDropDownMenu();
+ ShowDropDownMenu(ui::GetMenuSourceTypeForEvent(event));
}
}
@@ -132,12 +133,13 @@ void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) {
}
void ButtonDropDown::ShowContextMenuForView(View* source,
- const gfx::Point& point) {
+ const gfx::Point& point,
+ ui::MenuSourceType source_type) {
if (!enabled())
return;
show_menu_factory_.InvalidateWeakPtrs();
- ShowDropDownMenu();
+ ShowDropDownMenu(source_type);
}
bool ButtonDropDown::ShouldEnterPushedState(const ui::Event& event) {
@@ -153,7 +155,7 @@ bool ButtonDropDown::ShouldShowMenu() {
return true;
}
-void ButtonDropDown::ShowDropDownMenu() {
+void ButtonDropDown::ShowDropDownMenu(ui::MenuSourceType source_type) {
if (!ShouldShowMenu())
return;
@@ -191,6 +193,7 @@ void ButtonDropDown::ShowDropDownMenu() {
menu_runner_->RunMenuAt(GetWidget(), NULL,
gfx::Rect(menu_position, gfx::Size(0, 0)),
MenuItemView::TOPLEFT,
+ source_type,
MenuRunner::HAS_MNEMONICS);
if (result == MenuRunner::MENU_DELETED)
return;
@@ -202,6 +205,7 @@ void ButtonDropDown::ShowDropDownMenu() {
menu_runner_->RunMenuAt(GetWidget(), NULL,
gfx::Rect(menu_position, gfx::Size(0, 0)),
MenuItemView::TOPLEFT,
+ source_type,
MenuRunner::HAS_MNEMONICS);
if (result == MenuRunner::MENU_DELETED)
return;
« no previous file with comments | « ui/views/controls/button/button_dropdown.h ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698