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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 215 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
216 password_manager::CredentialSourceType type, | 216 password_manager::CredentialSourceType type, |
217 bool update_password) { | 217 bool update_password) { |
218 // Save password infobar and the password bubble prompts in case of | 218 // Save password infobar and the password bubble prompts in case of |
219 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 219 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
220 if (!BrowsingDataHelper::IsWebScheme( | 220 if (!BrowsingDataHelper::IsWebScheme( |
221 web_contents()->GetLastCommittedURL().scheme())) { | 221 web_contents()->GetLastCommittedURL().scheme())) { |
222 return false; | 222 return false; |
223 } | 223 } |
224 | 224 |
225 // Prevent the autofill password manager from prompting the second time. | |
226 if (type == password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API) | |
227 password_manager_.DropFormManagers(); | |
228 | |
229 if (IsTheHotNewBubbleUIEnabled()) { | 225 if (IsTheHotNewBubbleUIEnabled()) { |
230 #if !BUILDFLAG(ANDROID_JAVA_UI) | 226 #if !BUILDFLAG(ANDROID_JAVA_UI) |
231 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 227 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
232 PasswordsClientUIDelegateFromWebContents(web_contents()); | 228 PasswordsClientUIDelegateFromWebContents(web_contents()); |
233 if (update_password && IsUpdatePasswordUIEnabled()) { | 229 if (update_password && IsUpdatePasswordUIEnabled()) { |
234 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( | 230 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( |
235 std::move(form_to_save)); | 231 std::move(form_to_save)); |
236 } else { | 232 } else { |
237 manage_passwords_ui_controller->OnPasswordSubmitted( | 233 manage_passwords_ui_controller->OnPasswordSubmitted( |
238 std::move(form_to_save)); | 234 std::move(form_to_save)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 return; | 331 return; |
336 | 332 |
337 if (possible_auto_sign_in_->username_value == form.username_value && | 333 if (possible_auto_sign_in_->username_value == form.username_value && |
338 possible_auto_sign_in_->password_value == form.password_value && | 334 possible_auto_sign_in_->password_value == form.password_value && |
339 possible_auto_sign_in_->origin == form.origin) { | 335 possible_auto_sign_in_->origin == form.origin) { |
340 PromptUserToEnableAutosigninIfNecessary(); | 336 PromptUserToEnableAutosigninIfNecessary(); |
341 } | 337 } |
342 possible_auto_sign_in_.reset(); | 338 possible_auto_sign_in_.reset(); |
343 } | 339 } |
344 | 340 |
| 341 void ChromePasswordManagerClient::NotifyStorePasswordCalled() { |
| 342 // If a site stores a credential the autofill password manager shouldn't kick |
| 343 // in. |
| 344 password_manager_.DropFormManagers(); |
| 345 } |
| 346 |
345 void ChromePasswordManagerClient::AutomaticPasswordSave( | 347 void ChromePasswordManagerClient::AutomaticPasswordSave( |
346 std::unique_ptr<password_manager::PasswordFormManager> saved_form) { | 348 std::unique_ptr<password_manager::PasswordFormManager> saved_form) { |
347 #if BUILDFLAG(ANDROID_JAVA_UI) | 349 #if BUILDFLAG(ANDROID_JAVA_UI) |
348 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 350 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
349 #else | 351 #else |
350 if (IsTheHotNewBubbleUIEnabled()) { | 352 if (IsTheHotNewBubbleUIEnabled()) { |
351 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 353 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
352 PasswordsClientUIDelegateFromWebContents(web_contents()); | 354 PasswordsClientUIDelegateFromWebContents(web_contents()); |
353 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 355 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
354 std::move(saved_form)); | 356 std::move(saved_form)); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 password_manager::mojom::CredentialManagerRequest request) { | 623 password_manager::mojom::CredentialManagerRequest request) { |
622 content::WebContents* web_contents = | 624 content::WebContents* web_contents = |
623 content::WebContents::FromRenderFrameHost(render_frame_host); | 625 content::WebContents::FromRenderFrameHost(render_frame_host); |
624 DCHECK(web_contents); | 626 DCHECK(web_contents); |
625 | 627 |
626 ChromePasswordManagerClient* instance = | 628 ChromePasswordManagerClient* instance = |
627 ChromePasswordManagerClient::FromWebContents(web_contents); | 629 ChromePasswordManagerClient::FromWebContents(web_contents); |
628 DCHECK(instance); | 630 DCHECK(instance); |
629 instance->credential_manager_impl_.BindRequest(std::move(request)); | 631 instance->credential_manager_impl_.BindRequest(std::move(request)); |
630 } | 632 } |
OLD | NEW |