[Reland #2] Change ActionsController to only update DOM when displaying a menu

Previously ActionsController would calculate the additional actions for
Drive (share, create-shortcut, etc) and FSP [1] like change directory,
selection changed, and metadata updated. When these events arrive in
FilesApp, they update the <command> and <cr-menu> DOM state.

However, that can cause flickering in visible menus and also flakes in
browser tests based on menus, since these events can happen while the
menu is displayed for an entry or set of entries (selection) or affect
entries other than those associated with the menu.

This CL changes ActionsController to store state in an internal map,
rather than in the DOM, and to only update the menu DOM state when a
user-action shows the menu.

Change CommandHandler to set the visibility for Drive actions/commands
synchronously to avoid flickering the size of the menu - it still can
flicker the disabled state and pinned check-mark, but these are softer
to human eyes than the change in size.

Change ToolbarController to update its refresh button disabled state.
The button relied on FileManagerCommands to update the |refresh| state
command, which was not correct because the refresh button always acts
on the current directory, whereas the command was being evaluated for
different entries.

Change Action models and derived classes to have a |getEntries| method
so that ActionsController can get the entries that it is acting upon
to invalidate the state prior to executation.

Change ActionsSubMenu.setActionsModel to forward the target element,
so the <command> can be updated to the correct target element.

Change PluginVM test to use keyaboard shortcut instead of refresh
button, because it was failing to refresh speculatively due to the
button been disabled when clicked.

[1] https://developer.chrome.com/apps/fileSystemProvider#event-onGetActionsRequested

Change-Id: I33f322689d083b307e55ec9f045ee253bcde2c60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1608962
Commit-Queue: Noel Gordon <noel@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658967}
9 files changed