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

Issue 2876203003: Make shelf item can be dragged when context menu is opened.

Created:
3 years, 7 months ago by minch1
Modified:
3 years, 3 months ago
Reviewers:
xiyuan, sadrul, sky, msw
CC:
chromium-reviews, kalyank, tfarina
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make shelf item can be dragged when context menu is opened. Current context menu of shelf, 1) Allow dragging before context menu is created. 2) No dragging after context menu is opened. In order to keep the same as Android OS, 1) Allow dragging during the same press (don't release the finger) after context menu is opened. 2) Close the context menu once start dragging. Changes in this cl, 1. Add |SEND_UNHANDLED_GESTURES_TO_OWNER| in MenuRunner. This means the owner hopes that menu can help send the unhandled gesture events to the owner instead of dropping them. e.g, the context menu of the shelf items, and this is only true if shelf is not autohide. 2. Transfer events from owner to menu host if the owner needs gesture events. vice verse. e.g. Shelf items hope can be dragged after long press which will create the context menu. 3. Handle the LONG_TAP events on shelf items. Since gesture events been transferred from shelf to MenuHost, but we don't want it will show the context menu again. BUG=710601, 748253

Patch Set 1 #

Total comments: 7

Patch Set 2 : Transfer events only when the widget set capture. #

Patch Set 3 : TransferEvents only if it is needed. #

Total comments: 20

Patch Set 4 : Fixed comments. #

Total comments: 23

Patch Set 5 : Fixed comments. #

Patch Set 6 : Remove useless code. #

Patch Set 7 : Remove useless include. #

Patch Set 8 : Fixed comments. #

Total comments: 30

Patch Set 9 : Fixed comments. #

Patch Set 10 : Stop listening events if sees GESTURE_END. #

Patch Set 11 : Rebased and renamed. #

Total comments: 6

Patch Set 12 : Addressed xiyuan's comments. #

Patch Set 13 : rebased #

Total comments: 18

Patch Set 14 : Add ut. #

Patch Set 15 : Fixed comments and rebased. #

Patch Set 16 : Fixed tests. #

Total comments: 10

Patch Set 17 : Fixed msw's comments. #

Total comments: 2

Patch Set 18 : Fixed nit. #

Total comments: 10

Patch Set 19 : Fixed comments. #

Patch Set 20 : Add set_run_types() in ShelfView. #

Patch Set 21 : Removed the logic for app list button. #

Patch Set 22 : Remove run_types_ flag. #

Patch Set 23 : Add widget observer for |owner_| in MenuHost. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+183 lines, -52 lines) Patch
M ash/shelf/shelf_button.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 1 chunk +4 lines, -0 lines 0 comments Download
M ash/shelf/shelf_view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +1 line, -0 lines 0 comments Download
M ash/shelf/shelf_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 6 chunks +14 lines, -6 lines 0 comments Download
M ui/views/controls/menu/menu_controller.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 6 chunks +33 lines, -19 lines 0 comments Download
M ui/views/controls/menu/menu_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +15 lines, -21 lines 0 comments Download
M ui/views/controls/menu/menu_controller_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5 chunks +57 lines, -3 lines 0 comments Download
M ui/views/controls/menu/menu_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +9 lines, -2 lines 0 comments Download
M ui/views/controls/menu/menu_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 6 chunks +42 lines, -1 line 0 comments Download
M ui/views/controls/menu/menu_runner.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -0 lines 0 comments Download
M ui/views/controls/menu/menu_runner_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 157 (113 generated)
xiyuan
https://codereview.chromium.org/2876203003/diff/1/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://codereview.chromium.org/2876203003/diff/1/ui/views/controls/menu/menu_controller.cc#newcode828 ui/views/controls/menu/menu_controller.cc:828: } nit: revist to something like if (part.submenu) { ...
3 years, 7 months ago (2017-05-12 20:24:57 UTC) #4
minch1
Hi, xiyuan@, can you help review?
3 years, 7 months ago (2017-05-15 18:05:23 UTC) #14
xiyuan
We probably can put added code in #if defined(OS_CHROMEOS) since they are chromeos specific and ...
3 years, 7 months ago (2017-05-15 19:20:53 UTC) #15
minch1
xiyuan@, can you help check the comments? Thanks. https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc File ash/shelf/shelf_view.cc (right): https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc#newcode1663 ash/shelf/shelf_view.cc:1663: if ...
3 years, 7 months ago (2017-05-15 22:16:35 UTC) #16
xiyuan
https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc File ash/shelf/shelf_view.cc (right): https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc#newcode1663 ash/shelf/shelf_view.cc:1663: if (index == 0 || !item) { On 2017/05/15 ...
3 years, 7 months ago (2017-05-15 22:41:11 UTC) #17
minch1
xiyuan@, could you help review? Thanks. https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc File ash/shelf/shelf_view.cc (right): https://codereview.chromium.org/2876203003/diff/40001/ash/shelf/shelf_view.cc#newcode1663 ash/shelf/shelf_view.cc:1663: if (index == ...
3 years, 7 months ago (2017-05-16 22:13:39 UTC) #25
xiyuan
https://codereview.chromium.org/2876203003/diff/60001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/60001/ash/shelf/shelf_button.cc#newcode29 ash/shelf/shelf_button.cc:29: #if defined(OS_CHROMEOS) Ash code is chromeos only now. So ...
3 years, 7 months ago (2017-05-16 22:46:57 UTC) #27
minch1
https://codereview.chromium.org/2876203003/diff/60001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/60001/ash/shelf/shelf_button.cc#newcode29 ash/shelf/shelf_button.cc:29: #if defined(OS_CHROMEOS) On 2017/05/16 22:46:56, xiyuan wrote: > Ash ...
3 years, 7 months ago (2017-05-17 16:55:38 UTC) #34
xiyuan
lgtm Cool. Let's get an owner to take a look. How feasible to write a ...
3 years, 7 months ago (2017-05-17 18:26:55 UTC) #41
minch1
msw@, xiyuan@, could you help review? Thanks.
3 years, 7 months ago (2017-05-17 21:00:27 UTC) #47
msw
+CC sky for menu code, would you like to review? https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode466 ...
3 years, 7 months ago (2017-05-17 23:03:30 UTC) #49
sky
Please add tests to cover what you are trying to accomplish. https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): ...
3 years, 7 months ago (2017-05-18 16:33:30 UTC) #51
minch1
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode466 ash/shelf/shelf_button.cc:466: views::MenuController* controller = On 2017/05/17 23:03:30, msw wrote: > ...
3 years, 7 months ago (2017-05-18 17:42:57 UTC) #52
xiyuan
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode469 ash/shelf/shelf_button.cc:469: controller->set_owner_needs_gesture_events(false); On 2017/05/18 17:42:57, minch1 wrote: > On 2017/05/18 ...
3 years, 7 months ago (2017-05-18 18:00:47 UTC) #53
sky
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode469 ash/shelf/shelf_button.cc:469: controller->set_owner_needs_gesture_events(false); On 2017/05/18 17:42:57, minch1 wrote: > On 2017/05/18 ...
3 years, 7 months ago (2017-05-18 19:43:12 UTC) #54
msw
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode466 ash/shelf/shelf_button.cc:466: views::MenuController* controller = On 2017/05/18 17:42:57, minch1 wrote: > ...
3 years, 7 months ago (2017-05-18 20:42:20 UTC) #55
minch1
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode466 ash/shelf/shelf_button.cc:466: views::MenuController* controller = On 2017/05/18 20:42:20, msw wrote: > ...
3 years, 7 months ago (2017-05-18 22:02:54 UTC) #56
msw
https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_button.cc#newcode466 ash/shelf/shelf_button.cc:466: views::MenuController* controller = On 2017/05/18 22:02:53, minch1 wrote: > ...
3 years, 7 months ago (2017-05-18 22:14:47 UTC) #57
minch1
Could you please help review? Thanks. https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_view.cc File ash/shelf/shelf_view.cc (right): https://codereview.chromium.org/2876203003/diff/140001/ash/shelf/shelf_view.cc#newcode1693 ash/shelf/shelf_view.cc:1693: // Shelf items ...
3 years, 7 months ago (2017-05-26 23:01:17 UTC) #81
xiyuan
https://codereview.chromium.org/2876203003/diff/200001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://codereview.chromium.org/2876203003/diff/200001/ui/views/controls/menu/menu_controller.cc#newcode834 ui/views/controls/menu/menu_controller.cc:834: // gesture events on the shelf can be created ...
3 years, 7 months ago (2017-05-26 23:13:38 UTC) #82
minch1
https://codereview.chromium.org/2876203003/diff/200001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://codereview.chromium.org/2876203003/diff/200001/ui/views/controls/menu/menu_controller.cc#newcode834 ui/views/controls/menu/menu_controller.cc:834: // gesture events on the shelf can be created ...
3 years, 6 months ago (2017-06-01 16:42:28 UTC) #91
xiyuan
The approach looks fine to me. sky@, sadural@ what do you think? minch@, could you ...
3 years, 6 months ago (2017-06-01 16:55:13 UTC) #92
msw
Nice, some comment nits. Tests seem like a very good idea. https://codereview.chromium.org/2876203003/diff/240001/ash/shelf/shelf_button.cc File ash/shelf/shelf_button.cc (right): ...
3 years, 6 months ago (2017-06-01 20:24:28 UTC) #93
sky
On 2017/06/01 20:24:28, msw wrote: > Nice, some comment nits. Tests seem like a very ...
3 years, 6 months ago (2017-06-01 22:01:16 UTC) #94
minch1
Really sorry for the delay. For "The shelf can then install a pre-target handler on ...
3 years, 6 months ago (2017-06-23 23:13:03 UTC) #108
sadrul
On 2017/06/23 23:13:03, minch1 wrote: > Really sorry for the delay. For "The shelf can ...
3 years, 5 months ago (2017-06-27 03:05:13 UTC) #109
minch1
On 2017/06/27 03:05:13, sadrul wrote: > On 2017/06/23 23:13:03, minch1 wrote: > > Really sorry ...
3 years, 5 months ago (2017-06-27 18:39:12 UTC) #110
sadrul
On 2017/06/27 18:39:12, minch1 wrote: > On 2017/06/27 03:05:13, sadrul wrote: > > On 2017/06/23 ...
3 years, 5 months ago (2017-06-28 04:57:48 UTC) #111
xiyuan
On 2017/06/28 04:57:48, sadrul wrote: > On 2017/06/27 18:39:12, minch1 wrote: > > On 2017/06/27 ...
3 years, 5 months ago (2017-06-28 14:53:54 UTC) #112
msw
lgtm with test nits; follow up with xiyuan and sadrul, but fwiw, I think the ...
3 years, 5 months ago (2017-06-29 19:02:10 UTC) #113
minch1
Thanks for your review. Fixed comments. And can I land it? https://codereview.chromium.org/2876203003/diff/300001/ui/views/controls/menu/menu_controller_unittest.cc File ui/views/controls/menu/menu_controller_unittest.cc (right): ...
3 years, 5 months ago (2017-06-30 19:53:08 UTC) #118
msw
lgtm with a nit; please wait for xiyuan or sadrul to reply before landing. https://codereview.chromium.org/2876203003/diff/320001/ui/views/controls/menu/menu_controller_unittest.cc ...
3 years, 5 months ago (2017-06-30 20:22:39 UTC) #119
minch1
Hi, sadrul@, xiyuan@, what's the further suggestion for this cl? https://codereview.chromium.org/2876203003/diff/320001/ui/views/controls/menu/menu_controller_unittest.cc File ui/views/controls/menu/menu_controller_unittest.cc (right): https://codereview.chromium.org/2876203003/diff/320001/ui/views/controls/menu/menu_controller_unittest.cc#newcode1139 ...
3 years, 4 months ago (2017-08-04 17:22:35 UTC) #124
xiyuan
lgtm Sadrul, can we go ahead and land with this?
3 years, 3 months ago (2017-08-29 18:27:43 UTC) #125
sadrul
https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu/menu_controller.cc#newcode840 ui/views/controls/menu/menu_controller.cc:840: if (send_gesture_events_to_owner()) { This should happen at the very ...
3 years, 3 months ago (2017-08-30 20:31:40 UTC) #126
minch1
Hi, Sadrul, please check the new ps. Thanks. https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu/menu_controller.cc#newcode840 ui/views/controls/menu/menu_controller.cc:840: if ...
3 years, 3 months ago (2017-08-31 23:21:03 UTC) #127
minch1
Hi, I just changed the logic in ShelfView. I think we only need to transfer ...
3 years, 3 months ago (2017-09-01 03:37:34 UTC) #141
xiyuan
On 2017/09/01 03:37:34, minch1 wrote: > Hi, I just changed the logic in ShelfView. I ...
3 years, 3 months ago (2017-09-01 17:13:54 UTC) #142
minch1
On 2017/09/01 17:13:54, xiyuan wrote: > On 2017/09/01 03:37:34, minch1 wrote: > > Hi, I ...
3 years, 3 months ago (2017-09-01 17:55:20 UTC) #143
xiyuan
On 2017/09/01 17:55:20, minch1 wrote: > On 2017/09/01 17:13:54, xiyuan wrote: > > On 2017/09/01 ...
3 years, 3 months ago (2017-09-01 18:02:31 UTC) #144
minch1
On 2017/09/01 18:02:31, xiyuan wrote: > On 2017/09/01 17:55:20, minch1 wrote: > > On 2017/09/01 ...
3 years, 3 months ago (2017-09-01 20:49:43 UTC) #147
xiyuan
PS22 lgtm
3 years, 3 months ago (2017-09-01 21:40:42 UTC) #148
sadrul
Sorry, I do not actively look at rietveld anymore. Please feel free to ping over ...
3 years, 3 months ago (2017-09-07 19:58:28 UTC) #152
minch1
3 years, 3 months ago (2017-09-07 20:54:56 UTC) #153
https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu...
File ui/views/controls/menu/menu_host.cc (right):

https://codereview.chromium.org/2876203003/diff/340001/ui/views/controls/menu...
ui/views/controls/menu/menu_host.cc:134: owner_ = parent;
On 2017/09/07 19:58:28, sadrul wrote:
> On 2017/08/31 23:21:02, minch1 wrote:
> > On 2017/08/30 20:31:39, sadrul wrote:
> > > What if |owner_| is destroyed after the menu comes up? If we expect it
won't
> > > happen, can we validate that (e.g. add some DCHECK()s somewhere)?
> > 
> > Added DCHECK(owner()) when we need to send events back in
> > MenuController::OnGestureEvent. In HideMenuHost checked the owner_ before
> > transfer events back to the owner.
> 
> If |owner_| is destroyed, the DCHECK() won't hit though, right? So that
DCHECK()
> is not really verifying that we are using an existing owner.

Do you mean that |parent| is destroyed after assigned to |owner_| here? But in
HideMenuHost we may still transfer events back to a not exist |parent|?

Powered by Google App Engine
This is Rietveld 408576698