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

Unified Diff: ash/shelf/shelf_view.cc

Issue 2876203003: Make shelf item can be dragged when context menu is opened.
Patch Set: Fixed msw's comments. Created 3 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
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index acbef66d2ed93e81dc6576c84ddf59074dbc642c..91e9294d6df228c6ebd43be798153b024e1750c3 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -654,6 +654,8 @@ bool ShelfView::ShouldEventActivateButton(View* view, const ui::Event& event) {
void ShelfView::PointerPressedOnButton(views::View* view,
Pointer pointer,
const ui::LocatedEvent& event) {
+ if (IsShowingMenu())
+ launcher_menu_runner_->Cancel();
if (drag_view_)
return;
@@ -1683,7 +1685,7 @@ void ShelfView::ShowContextMenuForView(views::View* source,
last_pressed_index_ = -1;
const ShelfItem* item = ShelfItemForView(source);
- if (!item) {
+ if (!item || item->type == TYPE_APP_LIST) {
ShellPort::Get()->ShowContextMenu(context_menu_point, source_type);
return;
}
@@ -1714,6 +1716,11 @@ void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model,
if (context_menu)
run_types |=
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::FIXED_ANCHOR;
+
+ // Shelf items can only be dragged if the shelf is not in auto-hide.
+ if (shelf()->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_NEVER)
+ run_types |= views::MenuRunner::SEND_GESTURE_EVENTS_TO_OWNER;
+
launcher_menu_runner_.reset(
new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types));
@@ -1766,10 +1773,6 @@ void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model,
void ShelfView::OnMenuClosed(views::InkDrop* ink_drop) {
context_menu_id_ = ShelfID();
- // Hide the hide overflow bubble after showing a context menu for its items.
- if (owner_overflow_bubble_)
- owner_overflow_bubble_->Hide();
-
closing_event_time_ = launcher_menu_runner_->closing_event_time();
if (ink_drop)

Powered by Google App Engine
This is Rietveld 408576698