The purpose of this document is to describe the structure of layered components and iOS code within the Chromium source tree. This document assumes the context of the accompanying high-level design and technical strategy documents.
There will be a new top-level directory, ios/. This directory will contain the following:
web/: iOS’s src/content/ equivalent
chrome/: iOS’s src/chrome equivalent
provider/: the API via which Chromium code will call downstream iOS code
consumer/: the API via which downstream iOS code will call Chromium code
Each layered component will be divided as follows:
core/: shared code that is src/content/- and src/ios/-free.
content/: Content-based driver for the component.
ios/: Driver for the component based on src/ios/web/ and src/ios/embed/web/.
For components that are multi-process (i.e., currently have browser/, renderer/, etc. subdirectories), the process division will move to be under the content/ driver (since Chrome for iOS is single-process and almost never uses Chromium code that is not browser-process code).
Detailed Example/Discussion of DEPS Rules
The below example indicates a structure for form autofill wherein:
content- or ios-specific code detects that a form is being rendered
core code determines whether there is data with which to fill the form
content- or ios-specific code renders the data
Additionally, we assume that key components of the iOS flow (its WebContents-like object and the object that renders autofill data) are implemented downstream and exposed to upstream code via the embed layer, which will indeed be the case for some amount of time.
Structure under components/autofill/:
Listens for IPC from the renderer to know when a form is rendered and call into AutofillManager
Receives OnFormDataFilled calls from AutofillManager and sends IPC, which is caught by the renderer
Structure under ios/:
web/ (upstream impl code of the web layer)
chrome/ (startup, glue code, etc.)
ios/foo can depend on ios/provider/foo
ios/provider/foo can depend only on lower-layer consumer/ targets
ios/consumer/foo will depend on ios/foo (which can’t depend on ios/consumer/foo)
components/foo/ios can depend only on ios/web, ios/provider/web, and lower layers