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

Unified Diff: ash/shelf/shelf_view.cc

Issue 2885313002: Shelf context menu should spawn at cursor position for mouse events. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 5ab343329e7077c3761a20c9b8b526df0e6378c2..cf2b85c8309bc078fe140a6e3cb3641e4e01aa16 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -1632,26 +1632,29 @@ void ShelfView::AfterItemSelected(
void ShelfView::ShowContextMenuForView(views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
- // Align the context menu to the edge of the shelf.
- aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
- gfx::Rect shelf_bounds =
- is_overflow_mode()
- ? owner_overflow_bubble_->bubble_view()->GetBubbleBounds()
- : ScreenUtil::GetDisplayBoundsWithShelf(shelf_window);
-
- gfx::Point context_menu_point;
- switch (wm_shelf_->GetAlignment()) {
- case SHELF_ALIGNMENT_BOTTOM:
- case SHELF_ALIGNMENT_BOTTOM_LOCKED:
- context_menu_point.SetPoint(point.x(),
- shelf_bounds.bottom() - kShelfSize);
- break;
- case SHELF_ALIGNMENT_LEFT:
- context_menu_point.SetPoint(shelf_bounds.x() + kShelfSize, point.y());
- break;
- case SHELF_ALIGNMENT_RIGHT:
- context_menu_point.SetPoint(shelf_bounds.right() - kShelfSize, point.y());
- break;
+ gfx::Point context_menu_point = point;
+ // Align the context menu to the edge of the shelf for touch events.
+ if (source_type == ui::MenuSourceType::MENU_SOURCE_TOUCH) {
+ aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
+ gfx::Rect shelf_bounds =
+ is_overflow_mode()
+ ? owner_overflow_bubble_->bubble_view()->GetBubbleBounds()
+ : ScreenUtil::GetDisplayBoundsWithShelf(shelf_window);
+
+ switch (wm_shelf_->GetAlignment()) {
+ case SHELF_ALIGNMENT_BOTTOM:
+ case SHELF_ALIGNMENT_BOTTOM_LOCKED:
+ context_menu_point.SetPoint(point.x(),
+ shelf_bounds.bottom() - kShelfSize);
+ break;
+ case SHELF_ALIGNMENT_LEFT:
+ context_menu_point.SetPoint(shelf_bounds.x() + kShelfSize, point.y());
+ break;
+ case SHELF_ALIGNMENT_RIGHT:
+ context_menu_point.SetPoint(shelf_bounds.right() - kShelfSize,
+ point.y());
+ break;
+ }
}
last_pressed_index_ = -1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698