commit | 0ea22ea4fc583df0ea0a7f9f94f555f60a066c02 | [log] [tgz] |
---|---|---|
author | Joel Klinghed <the_jk@opera.com> | Wed Feb 20 22:04:22 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Feb 20 22:04:22 2019 |
tree | e5833fa731cc96b10e9a1f84bdddb028e777db4c | |
parent | fcabd6d1236bc15e66ddec905d7bc40610c44e07 [diff] |
Reland: Add RenderFrameHost as parameter to WebContentsDelegate::HandleContextMenu This is a reland of the following change: commit 5705b913a577759d16b3eca7d5b0e7b5c79421f6 https://chromium-review.googlesource.com/c/1472696 Reverted in 328cae2c82cb2e079658944f626883df74ed5c5a Fix for reland: In HandleContextMenuDelegate unittest, return true to stop the tested WebContents instance to call ShowContextMenu(). On some platforms (android) the WebContentsView implementation assumes that the RenderWidgetHostView is also a platform specific implementation. The test for WebContents is using mocked versions. Anyway, the point was not to test ShowContextMenu but HandleContextMenu so better to limit the test. Original description: To be able to do anything more complicated than block all context menu handling in HandleContextMenu you need the associated WebContents object. Current implementation that do something more currently handles that by either being a WebContentsObserver or keeping the WebContents object some other way. After WebContents checks WebContentsDelegate::HandleContextMenu the next delegate to get a chance is WebContentsViewDelegate::ShowContextMenu which takes a RenderFrameHost as additional parameter. This is all you need to get the WebContents object and other related information. So, to simplify writing WebContentsDelegate:s and override the context menu handling by actually showing something, include RenderFrameHost also in the HandleContextMenu call. I selected RenderFrameHost instead of WebContents that many other delegate methods use because it matches ShowContextMenu signature and there are already other delegate methods that also uses RenderFrameHost instead. WebContentsDelegate is a very popular interface, so this modifies a lot of files in different components but the changes are mechanical. Bug: 932520 Change-Id: I91ab29e5bbf20ca3743a9b1db7b2c391a573605d Reviewed-on: https://chromium-review.googlesource.com/c/1478900 Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Joel Klinghed <the_jk@opera.com> Cr-Commit-Position: refs/heads/master@{#633900}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .