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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 216 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
217 password_manager::CredentialSourceType type, | 217 password_manager::CredentialSourceType type, |
218 bool update_password) { | 218 bool update_password) { |
219 // Save password infobar and the password bubble prompts in case of | 219 // Save password infobar and the password bubble prompts in case of |
220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
221 if (!BrowsingDataHelper::IsWebScheme( | 221 if (!BrowsingDataHelper::IsWebScheme( |
222 web_contents()->GetLastCommittedURL().scheme())) { | 222 web_contents()->GetLastCommittedURL().scheme())) { |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 // Prevent the autofill password manager from prompting the second time. | |
227 if (type == password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API) | |
228 password_manager_.DropFormManagers(); | |
229 | |
230 if (IsTheHotNewBubbleUIEnabled()) { | 226 if (IsTheHotNewBubbleUIEnabled()) { |
231 #if !BUILDFLAG(ANDROID_JAVA_UI) | 227 #if !BUILDFLAG(ANDROID_JAVA_UI) |
232 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 228 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
233 PasswordsClientUIDelegateFromWebContents(web_contents()); | 229 PasswordsClientUIDelegateFromWebContents(web_contents()); |
234 if (update_password && IsUpdatePasswordUIEnabled()) { | 230 if (update_password && IsUpdatePasswordUIEnabled()) { |
235 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( | 231 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( |
236 std::move(form_to_save)); | 232 std::move(form_to_save)); |
237 } else { | 233 } else { |
238 manage_passwords_ui_controller->OnPasswordSubmitted( | 234 manage_passwords_ui_controller->OnPasswordSubmitted( |
239 std::move(form_to_save)); | 235 std::move(form_to_save)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 return; | 332 return; |
337 | 333 |
338 if (possible_auto_sign_in_->username_value == form.username_value && | 334 if (possible_auto_sign_in_->username_value == form.username_value && |
339 possible_auto_sign_in_->password_value == form.password_value && | 335 possible_auto_sign_in_->password_value == form.password_value && |
340 possible_auto_sign_in_->origin == form.origin) { | 336 possible_auto_sign_in_->origin == form.origin) { |
341 PromptUserToEnableAutosigninIfNecessary(); | 337 PromptUserToEnableAutosigninIfNecessary(); |
342 } | 338 } |
343 possible_auto_sign_in_.reset(); | 339 possible_auto_sign_in_.reset(); |
344 } | 340 } |
345 | 341 |
| 342 void ChromePasswordManagerClient::NotifyStorePasswordCalled() { |
| 343 // If a site stores a credential the autofill password manager shouldn't kick |
| 344 // in. |
| 345 password_manager_.DropFormManagers(); |
| 346 } |
| 347 |
346 void ChromePasswordManagerClient::AutomaticPasswordSave( | 348 void ChromePasswordManagerClient::AutomaticPasswordSave( |
347 std::unique_ptr<password_manager::PasswordFormManager> saved_form) { | 349 std::unique_ptr<password_manager::PasswordFormManager> saved_form) { |
348 #if BUILDFLAG(ANDROID_JAVA_UI) | 350 #if BUILDFLAG(ANDROID_JAVA_UI) |
349 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 351 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
350 #else | 352 #else |
351 if (IsTheHotNewBubbleUIEnabled()) { | 353 if (IsTheHotNewBubbleUIEnabled()) { |
352 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 354 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
353 PasswordsClientUIDelegateFromWebContents(web_contents()); | 355 PasswordsClientUIDelegateFromWebContents(web_contents()); |
354 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 356 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
355 std::move(saved_form)); | 357 std::move(saved_form)); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 610 |
609 const password_manager::CredentialsFilter* | 611 const password_manager::CredentialsFilter* |
610 ChromePasswordManagerClient::GetStoreResultFilter() const { | 612 ChromePasswordManagerClient::GetStoreResultFilter() const { |
611 return &credentials_filter_; | 613 return &credentials_filter_; |
612 } | 614 } |
613 | 615 |
614 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 616 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
615 const { | 617 const { |
616 return log_manager_.get(); | 618 return log_manager_.get(); |
617 } | 619 } |
OLD | NEW |