OLD | NEW |
1 This directory is for features that are intended for reuse across multiple | 1 This directory is for features that are intended for reuse across multiple |
2 embedders (e.g., Android WebView and Chrome). | 2 embedders (e.g., Android WebView and Chrome). |
3 | 3 |
4 By default, subdirectories have the Content Module as the uppermost layer they | 4 By default, components can depend only on the lower layers of the Chromium |
5 depend on, i.e., they may depend only on the Content API (content/public) and | 5 codebase(e.g. base/, net/, etc.). Individual components may additionally allow |
6 on lower layers (e.g. base/, net/, ipc/ etc.). Individual subdirectories may | 6 dependencies on the content API and IPC; however, if such a component is used |
7 further restrict their dependencies, e.g., a component that is used by Chrome | 7 by Chrome for iOS (which does not use the content API or IPC), the component |
8 for iOS (which does not use the content API) will either disallow usage of | 8 will have to be in the form of a layered component |
9 content/public or be in the form of a layered component | |
10 (http://www.chromium.org/developers/design-documents/layered-components-design). | 9 (http://www.chromium.org/developers/design-documents/layered-components-design). |
11 | 10 |
12 Components that have bits of code that need to live in different | 11 Components that have bits of code that need to live in different |
13 processes (e.g. some code in the browser process, some in the renderer | 12 processes (e.g. some code in the browser process, some in the renderer |
14 process, etc.) should separate the code into different subdirectories. | 13 process, etc.) should separate the code into different subdirectories. |
15 Hence for a component named 'foo' you might end up with a structure | 14 Hence for a component named 'foo' you might end up with a structure |
16 like the following: | 15 like the following (assuming that foo is not used by iOS and thus does not |
| 16 need to be a layered component): |
17 | 17 |
18 components/foo - DEPS, OWNERS, foo.gypi | 18 components/foo - DEPS, OWNERS, foo.gypi |
19 components/foo/browser - code that needs the browser process | 19 components/foo/browser - code that needs the browser process |
20 components/foo/common - for e.g. IPC constants and such | 20 components/foo/common - for e.g. IPC constants and such |
21 components/foo/renderer - code that needs renderer process | 21 components/foo/renderer - code that needs renderer process |
22 | 22 |
23 These subdirectories should have DEPS files with the relevant | 23 These subdirectories should have DEPS files with the relevant |
24 restrictions in place, i.e. only components/*/browser should | 24 restrictions in place, i.e. only components/*/browser should |
25 be allowed to #include from content/public/browser. | 25 be allowed to #include from content/public/browser. |
26 | 26 |
27 Note that there may also be an 'android' subdir, with a Java source | 27 Note that there may also be an 'android' subdir, with a Java source |
28 code structure underneath it where the package name is | 28 code structure underneath it where the package name is |
29 org.chromium.components.foo, and with subdirs after 'foo' | 29 org.chromium.components.foo, and with subdirs after 'foo' |
30 to illustrate process, e.g. 'browser' or 'renderer': | 30 to illustrate process, e.g. 'browser' or 'renderer': |
31 | 31 |
32 components/foo/android/OWNERS, DEPS | 32 components/foo/android/OWNERS, DEPS |
33 components/foo/android/java/src/org/chromium/components/foo/browser/ | 33 components/foo/android/java/src/org/chromium/components/foo/browser/ |
34 components/foo/android/javatests/src/org/chromium/components/foo/browser/ | 34 components/foo/android/javatests/src/org/chromium/components/foo/browser/ |
35 | 35 |
36 Code in a component should be placed in a namespace corresponding to | 36 Code in a component should be placed in a namespace corresponding to |
37 the name of the component; e.g. for a component living in | 37 the name of the component; e.g. for a component living in |
38 //components/foo, code in that component should be in the foo:: | 38 //components/foo, code in that component should be in the foo:: |
39 namespace. Note that it used to be the rule that all code under | 39 namespace. |
40 //components should be in the components:: namespace; this is being | |
41 phased out. | |
OLD | NEW |