• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

content/H12-Nov-2020-2,0811,522

core/H12-Nov-2020-85,20861,422

ios/H12-Nov-2020-2,7052,017

DEPSH A D07-Nov-2020683 2322

OWNERSH A D07-Nov-2020170 97

README.mdH A D07-Nov-20208.2 KiB166127

README.md

1# Password Manager
2
3The password manager is [a component layered](https://sites.google.com/a/chromium.org/dev/developers/design-documents/layered-components-design).
4
5This means that the code is spread out through the following directories:
6- ./core/: Essentials, not depending on any other layers. All other layers may
7  depend on core.
8- ./content/: Content-specific embedding.
9- ./ios/: iOS-specific embedding.
10
11*** note
12NOTE: Some embedder specific code must not be part of content (e.g. UI specific
13code) and located in
14- /chrome/browser/password_manager/
15- /chrome/android/java/src/org/chromium/chrome/browser/password_manager/
16- /ios/chrome/browser/passwords/
17***
18
19## High-level architecture
20
21The following architecture diagram shows instances of core classes. For
22simplicity, it shows the concrete instances in case of Chrome on desktop. In
23reality there exist further abstractions, e.g. the
24[`ChromePasswordManagerClient`] is the Chrome-specific implementation of the
25[`PasswordManagerClient`] interface. The [`ContentPasswordManagerDriver`] is the
26[content](https://www.chromium.org/developers/content-module) specific
27implementation of the `*::PasswordManagerDriver` interfaces.
28
29
30```
31Browser                                        + UI specific code in browser
32                                               | and further browser specific
33+-------------------+                          | code
34|PasswordFormManager<-------+                  |
35+-------------------+       |                  |
36                            |  1 per tab       |  1 per tab
37+-------------------+       +---------------+  |  +---------------------------+
38|PasswordFormManager<-------+PasswordManager<----->ChromePasswordManagerClient|
39+-------------------+       +-------+-------+  |  +-------------+-------------+
40                            |       |          |                |
41+-------------------+       |       |          |                |
42|PasswordFormManager<-------+       |          |                |
43+-------------------+               |          |                |
441 per form                          |          |  +-------------v-------------+
45                                    |          |  |PasswordManagerUIController|
46                        1 per frame |          |  +---------------------------+
47            +-----------------------+----+     |
48            |ContentPasswordManagerDriver|     |
49            +-----------------------+----+     |
50                                    |          |
51+----------------------------------------------+------------------------------+
52                                    |
53Renderer                            |
54             +----------------------------------------------+
55             |                      |                       |
56             |                      |                       |
57             |                      |                       |
58     +-------+-----+   +------------+--------+   +----------v------------+
59     |AutofillAgent|   |PasswordAutofillAgent|   |PasswordGenerationAgent|
60     +-------------+   +---------------------+   +-----------------------+
61             1 of each per frame
62```
63
64Here is a summary of the core responsibilities of the classes and interfaces:
65
66* [`PasswordManagerClient`] interface (1 per tab)
67
68  Abstracts operations that depend on the embedder environment (e.g. Chromium).
69  Manages settings (which features are enabled?), UI (popup bubbles, etc.),
70  provides access to the password store, etc.
71
72  * [`ChromePasswordManagerClient`]
73
74    Chrome's implementation of the [`PasswordManagerClient`] on non-iOS
75    platforms. This bootstraps the browser side classes at tab creation time.
76
77  * [`IOSChromePasswordManagerClient`] iOS implementation
78
79  * [`WebViewPasswordManagerClient`] //ios/web_view implementation
80
81  * [`StubPasswordManagerClient`] stub for mocking out calls to the embedder
82    in tests.
83
84* [`PasswordManager`] (1 per tab)
85
86  Embedder agnostic password manager, manages the life-cycle of password forms
87  (represented as [`PasswordFormManager`] instances). It is informed about newly
88  observed forms from the renderers and initiates the filling on page load and
89  (together with [`PasswordFormManager`]) save/update prompts on form
90  submission.
91
92* [`PasswordFormManager`] (1 per form)
93
94  This manages the life-cycle of an individual password form. It knows about
95  credentials that are stored on disk or a credential typed by the user. It
96  makes the decision which credentials should be filled into a form and whether
97  to offer password saving or updating existing credentials after a successful
98  form submission.
99
100* `*::PasswordManagerDriver` (1 per frame)
101
102  The `*::PasswordManagerDriver` is the browser-side communication end-point for
103  password related communication between the browser and renderers.
104
105  This is actually a collection of two interfaces named
106  `*::PasswordManagerDriver`. The first one ([`mojom::PasswordManagerDriver`])
107  is a [mojo](https://chromium.googlesource.com/chromium/src/+/master/mojo/)
108  interface that allows renderers to talk to the browser. The second one
109  ([`password_manager::PasswordManagerDriver`]) allows the browser to talk to
110  renderers.
111
112  * [`ContentPasswordManagerDriver`]
113
114    This is the [content](https://www.chromium.org/developers/content-module)
115    specific implementation of the `PasswordManagerDriver` interfaces.
116
117  * [`IOSChromePasswordManagerDriver`]
118
119    This is the iOS specific implementation.
120
121  * [`StubPasswordManagerDriver`]
122
123    A stub for mocking out communication to the renderer in tests.
124
125* [`AutofillAgent`] (1 per frame)
126
127  The renderer side implementation of Autofill, listens to DOM events and
128  autofill UI events, and dispatches them to the password manager specific
129  agents.
130
131  This implements the [`mojom::AutofillAgent`] interface.
132
133* [`PasswordAutofillAgent`] (1 per frame)
134
135  The renderer side implementation of filling credentials into the DOM and
136  capturing/extracting all relevant information and events from DOM.
137
138  This implements the [`mojom::PasswordAutofillAgent`] interface.
139
140* [`PasswordGenerationAgent`] (1 per frame)
141
142  The renderer side implementation of password generation.
143
144  This implements the [`mojom::PasswordGenerationAgent`] interface.
145
146[`AutofillAgent`]: https://cs.chromium.org/search?q=file:/autofill_agent.h$
147[`ChromePasswordManagerClient`]: https://cs.chromium.org/search?q=file:/chrome_password_manager_client.h$
148[`ContentPasswordManagerDriver`]: https://cs.chromium.org/search?q=file:/content_password_manager_driver.h$
149[`IOSChromePasswordManagerClient`]: https://cs.chromium.org/search?q=file:/ios_chrome_password_manager_client.h$
150[`IOSChromePasswordManagerDriver`]: https://cs.chromium.org/search?q=file:/ios_chrome_password_manager_driver.h$
151[`mojom::AutofillAgent`]: https://cs.chromium.org/search?q=file:autofill_agent.mojom+"interface+AutofillAgent"
152[`mojom::PasswordAutofillAgent`]: https://cs.chromium.org/search?q=file:autofill_agent.mojom+"interface+PasswordAutofillAgent"
153[`mojom::PasswordGenerationAgent`]: https://cs.chromium.org/search?q=file:autofill_agent.mojom+"interface+PasswordGenerationAgent"
154[`mojom::PasswordManagerDriver`]: https://cs.chromium.org/search?q=file:autofill_driver.mojom+"interface+PasswordManagerDriver"
155[`PasswordFormManager`]: https://cs.chromium.org/search?q=file:/password_form_manager.h$
156[`password_manager::PasswordManagerDriver`]: https://cs.chromium.org/search?q=file:/password_manager_driver.h$
157[`password_manager::PasswordManagerDriver`]: https://cs.chromium.org/search?q=file:/password_manager_driver.h$
158[`PasswordAutofillAgent`]: https://cs.chromium.org/search?q=file:/password_autofill_agent.h$
159[`PasswordFormManager`]: https://cs.chromium.org/search?q=file:/password_form_manager.h$
160[`PasswordGenerationAgent`]: https://cs.chromium.org/search?q=file:/password_generation_agent.h$
161[`PasswordManager`]: https://cs.chromium.org/search?q=file:/password_manager.h$
162[`PasswordManagerClient`]: https://cs.chromium.org/search?q=file:/password_manager_client.h$
163[`StubPasswordManagerClient`]: https://cs.chromium.org/search?q=file:/stub_password_manager_client.h$
164[`StubPasswordManagerDriver`]: https://cs.chromium.org/search?q=file:/stub_password_manager_driver.h$
165[`WebViewPasswordManagerClient`]: https://cs.chromium.org/search?q=file:/web_view_password_manager_client.h$
166