
Prior to this CL, destroy() was the method you called when you wanted to cleanup a WebContentsObserver, but it was also the method that was called when a WebContents was being destroyed (e.g. both the action to destroy, and the response to being destroyed). This introduces onDestroy(), which will be called both during web contents destruction, but also during a java side destruction (as if you deleted a C++ object). While normally, I try to keep C++ and Java API names consistent, I chose the generic #onDestroy vs #webContentsDestroyed because this could be triggered from cases where the web contents was not destroyed. If clients actually needed to distinguish between Java destruction and WebContents destruction, I would likely recommend we simply introduce a boolean `wasWebContentsDestroyed` that most clients would likely ignore as opposed to introducing two separate destruction paths. For now, we can keep this simpler. This also introduces an #observe(WebContents) method to be consistent with C++ in prep for a future CL to remove the addObserver / removeObserver from the public content API. Bug: None Change-Id: I541ea056968639e024aca8e6f87b08f33a6b10f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6169275 Reviewed-by: Bo Liu <boliu@chromium.org> Commit-Queue: Ted Choc <tedchoc@chromium.org> Cr-Commit-Position: refs/heads/main@{#1406336}
Chromium
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.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.