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 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 5 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
6 | 6 |
7 #include "components/autofill/content/browser/content_autofill_driver.h" | 7 #include "components/autofill/content/browser/content_autofill_driver.h" |
8 #include "components/autofill/core/common/form_data.h" | 8 #include "components/autofill/core/common/form_data.h" |
9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
10 #include "components/password_manager/content/browser/bad_message.h" | 10 #include "components/password_manager/content/browser/bad_message.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 ContentPasswordManagerDriver::ContentPasswordManagerDriver( | 43 ContentPasswordManagerDriver::ContentPasswordManagerDriver( |
44 content::RenderFrameHost* render_frame_host, | 44 content::RenderFrameHost* render_frame_host, |
45 PasswordManagerClient* client, | 45 PasswordManagerClient* client, |
46 autofill::AutofillClient* autofill_client) | 46 autofill::AutofillClient* autofill_client) |
47 : render_frame_host_(render_frame_host), | 47 : render_frame_host_(render_frame_host), |
48 client_(client), | 48 client_(client), |
49 password_generation_manager_(client, this), | 49 password_generation_manager_(client, this), |
50 password_autofill_manager_(this, autofill_client), | 50 password_autofill_manager_(this, autofill_client), |
51 next_free_key_(0), | 51 next_free_key_(0), |
52 binding_(this), | 52 password_manager_binding_(this), |
53 weak_factory_(this) {} | 53 weak_factory_(this) {} |
54 | 54 |
55 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { | 55 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 ContentPasswordManagerDriver* | 59 ContentPasswordManagerDriver* |
60 ContentPasswordManagerDriver::GetForRenderFrameHost( | 60 ContentPasswordManagerDriver::GetForRenderFrameHost( |
61 content::RenderFrameHost* render_frame_host) { | 61 content::RenderFrameHost* render_frame_host) { |
62 ContentPasswordManagerDriverFactory* factory = | 62 ContentPasswordManagerDriverFactory* factory = |
63 ContentPasswordManagerDriverFactory::FromWebContents( | 63 ContentPasswordManagerDriverFactory::FromWebContents( |
64 content::WebContents::FromRenderFrameHost(render_frame_host)); | 64 content::WebContents::FromRenderFrameHost(render_frame_host)); |
65 return factory ? factory->GetDriverForFrame(render_frame_host) : nullptr; | 65 return factory ? factory->GetDriverForFrame(render_frame_host) : nullptr; |
66 } | 66 } |
67 | 67 |
68 void ContentPasswordManagerDriver::BindRequest( | 68 void ContentPasswordManagerDriver::BindRequest( |
69 autofill::mojom::PasswordManagerDriverRequest request) { | 69 autofill::mojom::PasswordManagerDriverRequest request) { |
70 binding_.Bind(std::move(request)); | 70 password_manager_binding_.Bind(std::move(request)); |
| 71 } |
| 72 |
| 73 void ContentPasswordManagerDriver::BindSensitiveInputVisibilityServiceRequest( |
| 74 blink::mojom::SensitiveInputVisibilityServiceRequest request) { |
| 75 sensitive_input_visibility_bindings_.AddBinding(this, std::move(request)); |
71 } | 76 } |
72 | 77 |
73 void ContentPasswordManagerDriver::FillPasswordForm( | 78 void ContentPasswordManagerDriver::FillPasswordForm( |
74 const autofill::PasswordFormFillData& form_data) { | 79 const autofill::PasswordFormFillData& form_data) { |
75 const int key = next_free_key_++; | 80 const int key = next_free_key_++; |
76 password_autofill_manager_.OnAddPasswordFormMapping(key, form_data); | 81 password_autofill_manager_.OnAddPasswordFormMapping(key, form_data); |
77 GetPasswordAutofillAgent()->FillPasswordForm(key, form_data); | 82 GetPasswordAutofillAgent()->FillPasswordForm(key, form_data); |
78 } | 83 } |
79 | 84 |
80 void ContentPasswordManagerDriver::AllowPasswordGenerationForForm( | 85 void ContentPasswordManagerDriver::AllowPasswordGenerationForForm( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 201 |
197 void ContentPasswordManagerDriver::OnFocusedPasswordFormFound( | 202 void ContentPasswordManagerDriver::OnFocusedPasswordFormFound( |
198 const autofill::PasswordForm& password_form) { | 203 const autofill::PasswordForm& password_form) { |
199 if (!CheckChildProcessSecurityPolicy( | 204 if (!CheckChildProcessSecurityPolicy( |
200 password_form.origin, | 205 password_form.origin, |
201 BadMessageReason::CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND)) | 206 BadMessageReason::CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND)) |
202 return; | 207 return; |
203 GetPasswordManager()->OnPasswordFormForceSaveRequested(this, password_form); | 208 GetPasswordManager()->OnPasswordFormForceSaveRequested(this, password_form); |
204 } | 209 } |
205 | 210 |
| 211 void ContentPasswordManagerDriver::PasswordFieldVisibleInInsecureContext() { |
| 212 // TODO(estark): notify the WebContents that a password field was |
| 213 // shown, which will downgrade the security UI |
| 214 // appropriately. https://crbug.com/647560 |
| 215 } |
| 216 |
206 void ContentPasswordManagerDriver::DidNavigateFrame( | 217 void ContentPasswordManagerDriver::DidNavigateFrame( |
207 const content::LoadCommittedDetails& details, | 218 const content::LoadCommittedDetails& details, |
208 const content::FrameNavigateParams& params) { | 219 const content::FrameNavigateParams& params) { |
209 // Clear page specific data after main frame navigation. | 220 // Clear page specific data after main frame navigation. |
210 if (!render_frame_host_->GetParent() && !details.is_in_page) { | 221 if (!render_frame_host_->GetParent() && !details.is_in_page) { |
211 GetPasswordManager()->DidNavigateMainFrame(); | 222 GetPasswordManager()->DidNavigateMainFrame(); |
212 GetPasswordAutofillManager()->DidNavigateMainFrame(); | 223 GetPasswordAutofillManager()->DidNavigateMainFrame(); |
213 } | 224 } |
214 } | 225 } |
215 | 226 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { | 325 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { |
315 if (!password_gen_agent_) { | 326 if (!password_gen_agent_) { |
316 render_frame_host_->GetRemoteInterfaces()->GetInterface( | 327 render_frame_host_->GetRemoteInterfaces()->GetInterface( |
317 mojo::GetProxy(&password_gen_agent_)); | 328 mojo::GetProxy(&password_gen_agent_)); |
318 } | 329 } |
319 | 330 |
320 return password_gen_agent_; | 331 return password_gen_agent_; |
321 } | 332 } |
322 | 333 |
323 } // namespace password_manager | 334 } // namespace password_manager |
OLD | NEW |