The WebKit source code and documentation uses the term “Chrome Client” often to describe a certain class used for front-end display. I’m confused by what the term “Chrome” refers to, as it seems to be unrelated to the Google Chromium port. It’s difficult to search for any information about this on the web, because the search terms “chrome” and “client” inevitably bring up results relating to the Google Chrome browser, or merely give me links to the WebKit source code.
Can anyone explain what Chrome Client is, and what “Chrome” means in this context?
ChromeClientis an abstract interface that WebCore uses to interact with the multiple WebKit API layers that are built on top of WebCore. Its functionality centers around the user interface (aka “chrome”) aspects of the view containing a particular WebCorePage. This abstraction is important as there are a number of separate API layers built on top of WebCore, and how each API layer handles the user interface can differ even between API layers running on the same OS (for instance, WebKit and WebKit2 have quite different needs).As a simple example,
ChromeClient::runJavaScriptAlertis called by the JavaScriptalertfunction. The implementation ofrunJavaScriptAlertfor the CocoaWebViewclass simply calls in to the appropriateWebUIDelegatemethods as one would expect. Other cases, such as the display of tooltips, are handled entirely by the concreteChromeClientimplementation directly without involving any ofWebView‘s delegates.