OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI
VER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI
VER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI
VER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRI
VER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/autofill/content/public/interfaces/autofill_agent.mojom.h" | 13 #include "components/autofill/content/public/interfaces/autofill_agent.mojom.h" |
14 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" | 14 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" |
15 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 15 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
16 #include "components/autofill/core/common/password_form_generation_data.h" | 16 #include "components/autofill/core/common/password_form_generation_data.h" |
17 #include "components/password_manager/core/browser/password_autofill_manager.h" | 17 #include "components/password_manager/core/browser/password_autofill_manager.h" |
18 #include "components/password_manager/core/browser/password_generation_manager.h
" | 18 #include "components/password_manager/core/browser/password_generation_manager.h
" |
19 #include "components/password_manager/core/browser/password_manager.h" | 19 #include "components/password_manager/core/browser/password_manager.h" |
20 #include "components/password_manager/core/browser/password_manager_driver.h" | 20 #include "components/password_manager/core/browser/password_manager_driver.h" |
21 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
| 22 #include "mojo/public/cpp/bindings/binding_set.h" |
| 23 #include "third_party/WebKit/public/platform/modules/sensitive_input_visibility/
sensitive_input_visibility_service.mojom.h" |
22 | 24 |
23 namespace autofill { | 25 namespace autofill { |
24 class AutofillManager; | 26 class AutofillManager; |
25 struct PasswordForm; | 27 struct PasswordForm; |
26 } | 28 } |
27 | 29 |
28 namespace content { | 30 namespace content { |
29 struct FrameNavigateParams; | 31 struct FrameNavigateParams; |
30 struct LoadCommittedDetails; | 32 struct LoadCommittedDetails; |
31 class RenderFrameHost; | 33 class RenderFrameHost; |
32 class WebContents; | 34 class WebContents; |
33 } | 35 } |
34 | 36 |
35 namespace IPC { | 37 namespace IPC { |
36 class Message; | 38 class Message; |
37 } | 39 } |
38 | 40 |
39 namespace password_manager { | 41 namespace password_manager { |
40 enum class BadMessageReason; | 42 enum class BadMessageReason; |
41 | 43 |
42 // There is one ContentPasswordManagerDriver per RenderFrameHost. | 44 // There is one ContentPasswordManagerDriver per RenderFrameHost. |
43 // The lifetime is managed by the ContentPasswordManagerDriverFactory. | 45 // The lifetime is managed by the ContentPasswordManagerDriverFactory. |
44 class ContentPasswordManagerDriver | 46 class ContentPasswordManagerDriver |
45 : public PasswordManagerDriver, | 47 : public PasswordManagerDriver, |
46 public autofill::mojom::PasswordManagerDriver { | 48 public autofill::mojom::PasswordManagerDriver, |
| 49 public blink::mojom::SensitiveInputVisibilityService { |
47 public: | 50 public: |
48 ContentPasswordManagerDriver(content::RenderFrameHost* render_frame_host, | 51 ContentPasswordManagerDriver(content::RenderFrameHost* render_frame_host, |
49 PasswordManagerClient* client, | 52 PasswordManagerClient* client, |
50 autofill::AutofillClient* autofill_client); | 53 autofill::AutofillClient* autofill_client); |
51 ~ContentPasswordManagerDriver() override; | 54 ~ContentPasswordManagerDriver() override; |
52 | 55 |
53 // Gets the driver for |render_frame_host|. | 56 // Gets the driver for |render_frame_host|. |
54 static ContentPasswordManagerDriver* GetForRenderFrameHost( | 57 static ContentPasswordManagerDriver* GetForRenderFrameHost( |
55 content::RenderFrameHost* render_frame_host); | 58 content::RenderFrameHost* render_frame_host); |
56 | 59 |
57 void BindRequest(autofill::mojom::PasswordManagerDriverRequest request); | 60 void BindRequest(autofill::mojom::PasswordManagerDriverRequest request); |
| 61 void BindSensitiveInputVisibilityServiceRequest( |
| 62 blink::mojom::SensitiveInputVisibilityServiceRequest request); |
58 | 63 |
59 // PasswordManagerDriver implementation. | 64 // PasswordManagerDriver implementation. |
60 void FillPasswordForm( | 65 void FillPasswordForm( |
61 const autofill::PasswordFormFillData& form_data) override; | 66 const autofill::PasswordFormFillData& form_data) override; |
62 void AllowPasswordGenerationForForm( | 67 void AllowPasswordGenerationForForm( |
63 const autofill::PasswordForm& form) override; | 68 const autofill::PasswordForm& form) override; |
64 void FormsEligibleForGenerationFound( | 69 void FormsEligibleForGenerationFound( |
65 const std::vector<autofill::PasswordFormGenerationData>& forms) override; | 70 const std::vector<autofill::PasswordFormGenerationData>& forms) override; |
66 void AutofillDataReceived( | 71 void AutofillDataReceived( |
67 const std::map<autofill::FormData, | 72 const std::map<autofill::FormData, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void PasswordAutofillAgentConstructed() override; | 113 void PasswordAutofillAgentConstructed() override; |
109 void RecordSavePasswordProgress(const std::string& log) override; | 114 void RecordSavePasswordProgress(const std::string& log) override; |
110 void SaveGenerationFieldDetectedByClassifier( | 115 void SaveGenerationFieldDetectedByClassifier( |
111 const autofill::PasswordForm& password_form, | 116 const autofill::PasswordForm& password_form, |
112 const base::string16& generation_field) override; | 117 const base::string16& generation_field) override; |
113 | 118 |
114 void OnPasswordFormsParsedNoRenderCheck( | 119 void OnPasswordFormsParsedNoRenderCheck( |
115 const std::vector<autofill::PasswordForm>& forms); | 120 const std::vector<autofill::PasswordForm>& forms); |
116 void OnFocusedPasswordFormFound(const autofill::PasswordForm& password_form); | 121 void OnFocusedPasswordFormFound(const autofill::PasswordForm& password_form); |
117 | 122 |
| 123 // blink::mojom::SensitiveInputVisibility: |
| 124 void PasswordFieldVisibleInInsecureContext() override; |
| 125 |
118 private: | 126 private: |
119 bool CheckChildProcessSecurityPolicy(const GURL& url, | 127 bool CheckChildProcessSecurityPolicy(const GURL& url, |
120 BadMessageReason reason); | 128 BadMessageReason reason); |
121 | 129 |
122 const autofill::mojom::AutofillAgentPtr& GetAutofillAgent(); | 130 const autofill::mojom::AutofillAgentPtr& GetAutofillAgent(); |
123 | 131 |
124 const autofill::mojom::PasswordAutofillAgentPtr& GetPasswordAutofillAgent(); | 132 const autofill::mojom::PasswordAutofillAgentPtr& GetPasswordAutofillAgent(); |
125 | 133 |
126 const autofill::mojom::PasswordGenerationAgentPtr& | 134 const autofill::mojom::PasswordGenerationAgentPtr& |
127 GetPasswordGenerationAgent(); | 135 GetPasswordGenerationAgent(); |
128 | 136 |
129 content::RenderFrameHost* render_frame_host_; | 137 content::RenderFrameHost* render_frame_host_; |
130 PasswordManagerClient* client_; | 138 PasswordManagerClient* client_; |
131 PasswordGenerationManager password_generation_manager_; | 139 PasswordGenerationManager password_generation_manager_; |
132 PasswordAutofillManager password_autofill_manager_; | 140 PasswordAutofillManager password_autofill_manager_; |
133 | 141 |
134 // Every instance of PasswordFormFillData created by |*this| and sent to | 142 // Every instance of PasswordFormFillData created by |*this| and sent to |
135 // PasswordAutofillManager and PasswordAutofillAgent is given an ID, so that | 143 // PasswordAutofillManager and PasswordAutofillAgent is given an ID, so that |
136 // the latter two classes can reference to the same instance without sending | 144 // the latter two classes can reference to the same instance without sending |
137 // it to each other over IPC. The counter below is used to generate new IDs. | 145 // it to each other over IPC. The counter below is used to generate new IDs. |
138 int next_free_key_; | 146 int next_free_key_; |
139 | 147 |
140 autofill::mojom::PasswordAutofillAgentPtr password_autofill_agent_; | 148 autofill::mojom::PasswordAutofillAgentPtr password_autofill_agent_; |
141 | 149 |
142 autofill::mojom::PasswordGenerationAgentPtr password_gen_agent_; | 150 autofill::mojom::PasswordGenerationAgentPtr password_gen_agent_; |
143 | 151 |
144 mojo::Binding<autofill::mojom::PasswordManagerDriver> binding_; | 152 mojo::Binding<autofill::mojom::PasswordManagerDriver> |
| 153 password_manager_binding_; |
| 154 mojo::BindingSet<blink::mojom::SensitiveInputVisibilityService> |
| 155 sensitive_input_visibility_bindings_; |
145 | 156 |
146 base::WeakPtrFactory<ContentPasswordManagerDriver> weak_factory_; | 157 base::WeakPtrFactory<ContentPasswordManagerDriver> weak_factory_; |
147 | 158 |
148 DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver); | 159 DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver); |
149 }; | 160 }; |
150 | 161 |
151 } // namespace password_manager | 162 } // namespace password_manager |
152 | 163 |
153 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_
DRIVER_H_ | 164 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_
DRIVER_H_ |
OLD | NEW |