Only dispatch cut/copy/paste accelerators to views which register for them.
This restores some of https://codereview.chromium.org/
1091703002/#ps40001 ; we
once again use the standard accelerator processing code to dispatch accelerators
instead of calling AcceleratorPressed() directly. To avoid the concerns I had
which led me to discard that patch originally, WebContents does not make use of
this route; the manual dispatch for its sake is still in place.
This prevents AccleratorPressed() from being called on focused views which
didn't register for the cut/copy/paste accelerators. Views differ about whether
to handle a call in such a case by simply returning false, or by DCHECK failing
(or similar). For those that do the latter, the old code would lead to a DCHECK
failure followed by unconditionally executing some other accelerator's handling
code, e.g. "escape was pressed, close the window".
This means that another potential fix here would be to change all instances of
AcceleratorPressed() to return false if the provided accelerator wasn't one they
were interested in. Not only is this a much larger change, it seems arguably
incorrect -- classes ought not to need to be defensive here.
BUG=495472
TEST=Open print preview, select cut from wrench menu, print preview should not close.
Review URL: https://codereview.chromium.org/
1214343006
Cr-Commit-Position: refs/heads/master@{#336925}