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

Unified Diff: ash/shelf/shelf_view.cc

Issue 2876203003: Make shelf item can be dragged when context menu is opened.
Patch Set: Fixed comments. 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
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 5ab343329e7077c3761a20c9b8b526df0e6378c2..ebc7bedd4239db9109e4eeea2d316346f648b6ab 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -642,6 +642,10 @@ bool ShelfView::ShouldEventActivateButton(View* view, const ui::Event& event) {
void ShelfView::PointerPressedOnButton(views::View* view,
Pointer pointer,
const ui::LocatedEvent& event) {
+#if defined(OS_CHROMEOS)
xiyuan 2017/05/16 22:46:57 not needed
minch1 2017/05/17 16:55:37 Done.
+ if (IsShowingMenu())
+ launcher_menu_runner_->Cancel();
+#endif
if (drag_view_)
return;
@@ -1656,7 +1660,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;
}
@@ -1687,6 +1691,13 @@ void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model,
if (context_menu)
run_types |=
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::FIXED_ANCHOR;
+
+#if defined(OS_CHROMEOS)
xiyuan 2017/05/16 22:46:56 not needed
minch1 2017/05/17 16:55:37 Done.
+ // Shelf items can only be dragged if the shelf is not autohide.
+ if (wm_shelf()->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_NEVER)
+ run_types |= views::MenuRunner::IS_DRAGGABLE;
+#endif
+
launcher_menu_runner_.reset(
new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types));
@@ -1739,9 +1750,11 @@ void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model,
void ShelfView::OnMenuClosed(views::InkDrop* ink_drop) {
context_menu_id_ = ShelfID();
+#if !defined(OS_CHROMEOS)
xiyuan 2017/05/16 22:46:57 remove the whole block if we don't need it on chro
minch1 2017/05/17 16:55:37 Done.
// Hide the hide overflow bubble after showing a context menu for its items.
if (owner_overflow_bubble_)
owner_overflow_bubble_->Hide();
+#endif
closing_event_time_ = launcher_menu_runner_->closing_event_time();

Powered by Google App Engine
This is Rietveld 408576698