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

Issue 2862783002: [iOS Clean] Wired up ContextMenuCommands. (Closed)

Created:
3 years, 7 months ago by kkhorimoto
Modified:
3 years, 6 months ago
CC:
chromium-reviews, marq+scrutinize_chromium.org, lpromero+watch_chromium.org, ios-reviews+clean_chromium.org, ios-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[iOS Clean] Wired up ContextMenuCommands. This CL updates WebContextMenuCoordinator and its associated mediator class to support more actions. It will load URLs and create new WebStates, but still does not perform corresponding animations to show newly created Tabs and their loaded content. BUG=none Review-Url: https://codereview.chromium.org/2862783002 Cr-Commit-Position: refs/heads/master@{#475257} Committed: https://chromium.googlesource.com/chromium/src/+/ffa157bf17edd17189c334a3bbdd5ec40d50d07c

Patch Set 1 #

Total comments: 15

Patch Set 2 : use data source to tie dispatched commands with coordinator stopping #

Patch Set 3 : cleanup #

Patch Set 4 : Use context objects, selectors instead of invocation/blocks #

Patch Set 5 : cleanup #

Total comments: 31

Patch Set 6 : Ed's comments #

Patch Set 7 : cleanup #

Total comments: 6

Patch Set 8 : Ed's nits, test fixes #

Patch Set 9 : fix deps #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+660 lines, -136 lines) Patch
M ios/clean/chrome/browser/ui/commands/BUILD.gn View 2 3 1 chunk +1 line, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/commands/context_menu_commands.h View 1 2 3 4 5 1 chunk +31 lines, -0 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/BUILD.gn View 1 2 3 4 5 6 7 8 4 chunks +13 lines, -1 line 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_consumer.h View 1 2 3 4 1 chunk +10 lines, -19 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_consumer.mm View 1 2 3 1 chunk +0 lines, -28 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_context.h View 1 2 3 4 5 1 chunk +15 lines, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_context.mm View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h View 1 2 3 4 5 1 chunk +43 lines, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.mm View 1 2 3 1 chunk +55 lines, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_item.h View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
A ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm View 1 2 3 4 5 1 chunk +48 lines, -0 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_mediator.h View 1 2 3 4 5 6 1 chunk +9 lines, -2 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_mediator.mm View 1 2 3 4 5 1 chunk +92 lines, -23 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_mediator_unittest.mm View 1 2 3 4 5 6 7 1 chunk +92 lines, -12 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.h View 1 2 3 4 1 chunk +5 lines, -4 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm View 1 2 3 4 5 3 chunks +51 lines, -16 lines 2 comments Download
M ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h View 1 2 3 4 1 chunk +9 lines, -0 lines 0 comments Download
M ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm View 1 2 3 4 5 2 chunks +39 lines, -6 lines 0 comments Download
M ios/clean/chrome/browser/ui/tab_grid/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm View 1 2 3 7 chunks +61 lines, -22 lines 0 comments Download
M ios/clean/chrome/browser/ui/web_contents/BUILD.gn View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm View 1 2 3 4 5 6 7 3 chunks +43 lines, -3 lines 0 comments Download

Messages

Total messages: 34 (12 generated)
kkhorimoto
3 years, 7 months ago (2017-05-04 05:29:12 UTC) #2
kkhorimoto
https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h File ios/clean/chrome/browser/ui/commands/context_menu_commands.h (right): https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h#newcode15 ios/clean/chrome/browser/ui/commands/context_menu_commands.h:15: - (void)openURLInNewTab:(const GURL*)URL; Do we currently have any mechanism ...
3 years, 7 months ago (2017-05-04 05:38:01 UTC) #3
marq (ping after 24h)
Great start! https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h File ios/clean/chrome/browser/ui/commands/context_menu_commands.h (right): https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h#newcode15 ios/clean/chrome/browser/ui/commands/context_menu_commands.h:15: - (void)openURLInNewTab:(const GURL*)URL; On 2017/05/04 05:38:01, kkhorimoto_ ...
3 years, 7 months ago (2017-05-04 09:41:28 UTC) #4
kkhorimoto
https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h File ios/clean/chrome/browser/ui/commands/context_menu_commands.h (right): https://codereview.chromium.org/2862783002/diff/1/ios/clean/chrome/browser/ui/commands/context_menu_commands.h#newcode15 ios/clean/chrome/browser/ui/commands/context_menu_commands.h:15: - (void)openURLInNewTab:(const GURL*)URL; On 2017/05/04 09:41:28, marq (OOO to ...
3 years, 7 months ago (2017-05-05 05:17:54 UTC) #5
kkhorimoto
edchin: PTAL! I've updated this according to the advice Mark had in my first-round review ...
3 years, 7 months ago (2017-05-24 08:48:46 UTC) #6
edchin
I will review first thing in the morning. Sorry for the delay.
3 years, 7 months ago (2017-05-24 22:35:37 UTC) #7
kkhorimoto
On 2017/05/24 22:35:37, edchin wrote: > I will review first thing in the morning. Sorry ...
3 years, 7 months ago (2017-05-24 22:39:58 UTC) #8
edchin
Sorry for the late minute comments. They seem like a lot, but they are mostly ...
3 years, 7 months ago (2017-05-25 21:41:53 UTC) #9
kkhorimoto
https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/commands/context_menu_commands.h File ios/clean/chrome/browser/ui/commands/context_menu_commands.h (right): https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/commands/context_menu_commands.h#newcode13 ios/clean/chrome/browser/ui/commands/context_menu_commands.h:13: // Executes |menuContext|'s script. On 2017/05/25 21:41:53, edchin wrote: ...
3 years, 7 months ago (2017-05-26 23:20:10 UTC) #10
kkhorimoto
cleanup
3 years, 7 months ago (2017-05-26 23:25:48 UTC) #11
edchin
lgtm with minor comments/nits. https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h File ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h (right): https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h#newcode27 ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h:27: @property(nonatomic, readonly) NSString* menuTitle; On ...
3 years, 6 months ago (2017-05-27 15:59:03 UTC) #12
kkhorimoto
https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm File ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm (right): https://codereview.chromium.org/2862783002/diff/80001/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm#newcode49 ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm:49: self.mediator = On 2017/05/27 15:59:03, edchin wrote: > On ...
3 years, 6 months ago (2017-05-27 23:09:04 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2862783002/140001
3 years, 6 months ago (2017-05-27 23:09:23 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/220528) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, ...
3 years, 6 months ago (2017-05-27 23:16:53 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2862783002/160001
3 years, 6 months ago (2017-05-28 05:29:44 UTC) #25
commit-bot: I haz the power
Committed patchset #9 (id:160001) as https://chromium.googlesource.com/chromium/src/+/ffa157bf17edd17189c334a3bbdd5ec40d50d07c
3 years, 6 months ago (2017-05-28 06:55:19 UTC) #28
marq (ping after 24h)
Overall LGTM! https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm File ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm (right): https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm#newcode26 ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm:26: command_imp(dispatcher, command, context); Why not -performSelector:withObject: ? ...
3 years, 6 months ago (2017-05-31 12:26:09 UTC) #29
kkhorimoto
https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm File ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm (right): https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm#newcode26 ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm:26: command_imp(dispatcher, command, context); On 2017/05/31 12:26:09, marq (ping after ...
3 years, 6 months ago (2017-05-31 18:00:20 UTC) #30
lpromero
On 2017/05/31 18:00:20, kkhorimoto_ wrote: > https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm > File ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm > (right): > > https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm#newcode26 ...
3 years, 6 months ago (2017-06-01 09:38:23 UTC) #31
marq (ping after 24h)
On 2017/06/01 09:38:23, lpromero wrote: > On 2017/05/31 18:00:20, kkhorimoto_ wrote: > > > https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm ...
3 years, 6 months ago (2017-06-01 09:43:13 UTC) #32
marq (ping after 24h)
On 2017/06/01 09:43:13, marq (ping after 24h) wrote: > On 2017/06/01 09:38:23, lpromero wrote: > ...
3 years, 6 months ago (2017-06-01 09:48:47 UTC) #33
kkhorimoto
3 years, 6 months ago (2017-06-01 16:52:18 UTC) #34
Message was sent while issue was closed.
On 2017/06/01 09:48:47, marq (ping after 24h) wrote:
> On 2017/06/01 09:43:13, marq (ping after 24h) wrote:
> > On 2017/06/01 09:38:23, lpromero wrote:
> > > On 2017/05/31 18:00:20, kkhorimoto_ wrote:
> > > >
> > >
> >
>
https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/brows...
> > > > File
> > ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm
> > > > (right):
> > > > 
> > > >
> > >
> >
>
https://codereview.chromium.org/2862783002/diff/160001/ios/clean/chrome/brows...
> > > >
> ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm:26:
> > > > command_imp(dispatcher, command, context);
> > > > On 2017/05/31 12:26:09, marq (ping after 24h) wrote:
> > > > > Why not -performSelector:withObject: ?
> > > > > 
> > > > > (my concern is that directly grabbing the IMP here short-circuits any
> > other
> > > > > dynamic method stuff, which is probably not something a view
controller
> > > should
> > > > > be doing).
> > > > 
> > > > |-performSelector:withObject| doesn't compile under ARC because the
> compiler
> > > has
> > > > no idea what the intended memory management is.  I've verified, and this
> is
> > > > correctly dispatched to the intended forwarding target, although I'll
> agree
> > > that
> > > > it seems a little ugly.
> > > 
> > > Note that we could silence the warning:
> > >
> >
>
https://cs.chromium.org/search/?q=Warc-performSelector-leaks&sq=package:chrom...
> > > The issue is that ARC doesn't know how to handle the memory management of
> the
> > > returned value, so it warns.
> > 
> > In cases (like this) where there's no return value, that seems like a bug
(in
> > ARC or clang). 
> > 
> > I'd prefer to silence the warning rather than jumping into runtime-land.
> 
> Also, now that I think about it, maybe supporting an arbitrary vector of
> commands is overkill. What's the problem with the view controller sending
> -hideContextMenu: after any configured selector? My worry is that this has
crept
> into speculative generality at the expense of comprehensibility.

I'm fine with just silencing the warning and using |-performSelector:| since
it's definitely nicer than using the IMP.  The reason I used the vector of
commands was because |-hideContextMenu:| only sometimes needs to be sent.  For
commands that open a new Tab, the context menu coordinator (and its web
coordinator) have already been stopped.

Powered by Google App Engine
This is Rietveld 408576698