| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 UpdatePasswordInfoBarDelegate::Create(web_contents(), | 289 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 290 std::move(form_to_save)); | 290 std::move(form_to_save)); |
| 291 } else { | 291 } else { |
| 292 SavePasswordInfoBarDelegate::Create(web_contents(), | 292 SavePasswordInfoBarDelegate::Create(web_contents(), |
| 293 std::move(form_to_save)); | 293 std::move(form_to_save)); |
| 294 } | 294 } |
| 295 #endif // !defined(OS_ANDROID) | 295 #endif // !defined(OS_ANDROID) |
| 296 return true; | 296 return true; |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ChromePasswordManagerClient::ShowManualFallbackForSaving( |
| 300 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
| 301 bool is_update) { |
| 302 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 303 return; |
| 304 |
| 305 #if !defined(OS_ANDROID) |
| 306 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 307 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 308 manage_passwords_ui_controller->OnShowManualFallbackForSaving( |
| 309 std::move(form_to_save), is_update); |
| 310 #endif // !defined(OS_ANDROID) |
| 311 } |
| 312 |
| 313 void ChromePasswordManagerClient::HideManualFallbackForSaving() { |
| 314 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 315 return; |
| 316 |
| 317 #if !defined(OS_ANDROID) |
| 318 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 319 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 320 manage_passwords_ui_controller->OnHideManualFallbackForSaving(); |
| 321 #endif // !defined(OS_ANDROID) |
| 322 } |
| 323 |
| 299 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 324 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
| 300 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 325 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
| 301 const GURL& origin, | 326 const GURL& origin, |
| 302 const CredentialsCallback& callback) { | 327 const CredentialsCallback& callback) { |
| 303 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one | 328 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one |
| 304 // form provided). | 329 // form provided). |
| 305 CredentialsCallback intercept = | 330 CredentialsCallback intercept = |
| 306 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, | 331 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, |
| 307 base::Unretained(this), callback, local_forms.size() == 1); | 332 base::Unretained(this), callback, local_forms.size() == 1); |
| 308 #if defined(OS_ANDROID) | 333 #if defined(OS_ANDROID) |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 // static | 794 // static |
| 770 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 795 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 771 std::string scheme = url.scheme(); | 796 std::string scheme = url.scheme(); |
| 772 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 797 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 773 scheme) && | 798 scheme) && |
| 774 #if BUILDFLAG(ENABLE_EXTENSIONS) | 799 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 775 scheme != extensions::kExtensionScheme && | 800 scheme != extensions::kExtensionScheme && |
| 776 #endif | 801 #endif |
| 777 scheme != content::kChromeDevToolsScheme); | 802 scheme != content::kChromeDevToolsScheme); |
| 778 } | 803 } |
| OLD | NEW |