[email protected] | f532178 | 2014-03-11 11:47:17 | [diff] [blame] | 1 | This directory is for features that are intended for reuse across multiple |
| 2 | embedders (e.g., Android WebView and Chrome). |
| 3 | |
| 4 | By default, subdirectories have the Content Module as the uppermost layer they |
| 5 | depend on, i.e., they may depend only on the Content API (content/public) and |
| 6 | on lower layers (e.g. base/, net/, ipc/ etc.). Individual subdirectories may |
| 7 | further restrict their dependencies, e.g., a component that is used by Chrome |
| 8 | for iOS (which does not use the content API) will either disallow usage of |
| 9 | content/public or be in the form of a layered component |
| 10 | (http://www.chromium.org/developers/design-documents/layered-components-design). |
[email protected] | 5ec3ed8 | 2012-12-27 11:44:00 | [diff] [blame] | 11 | |
| 12 | 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 |
| 14 | process, etc.) should separate the code into different subdirectories. |
| 15 | Hence for a component named 'foo' you might end up with a structure |
| 16 | like the following: |
| 17 | |
| 18 | components/foo - DEPS, OWNERS, foo.gypi |
| 19 | components/foo/browser - code that needs the browser process |
| 20 | components/foo/common - for e.g. IPC constants and such |
| 21 | components/foo/renderer - code that needs renderer process |
| 22 | |
| 23 | These subdirectories should have DEPS files with the relevant |
| 24 | restrictions in place, i.e. only components/*/browser should |
| 25 | be allowed to #include from content/public/browser. |
| 26 | |
| 27 | Note that there may also be an 'android' subdir, with a Java source |
| 28 | code structure underneath it where the package name is |
| 29 | org.chromium.components.foo, and with subdirs after 'foo' |
| 30 | to illustrate process, e.g. 'browser' or 'renderer': |
| 31 | |
| 32 | components/foo/android/OWNERS, DEPS |
| 33 | components/foo/android/java/src/org/chromium/components/foo/browser/ |
| 34 | components/foo/android/javatests/src/org/chromium/components/foo/browser/ |
| 35 | |
[email protected] | a70edd2 | 2013-04-09 09:23:04 | [diff] [blame] | 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 |
| 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 |
| 40 | //components should be in the components:: namespace; this is being |
| 41 | phased out. |