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::ShowManualFallback( |
| 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->OnShowManualFallback(std::move(form_to_save), |
| 309 is_update); |
| 310 #endif // !defined(OS_ANDROID) |
| 311 } |
| 312 |
| 313 void ChromePasswordManagerClient::HideManualFallback() { |
| 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->OnHideManualFallback(); |
| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 // static | 799 // static |
775 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 800 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
776 std::string scheme = url.scheme(); | 801 std::string scheme = url.scheme(); |
777 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 802 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
778 scheme) && | 803 scheme) && |
779 #if BUILDFLAG(ENABLE_EXTENSIONS) | 804 #if BUILDFLAG(ENABLE_EXTENSIONS) |
780 scheme != extensions::kExtensionScheme && | 805 scheme != extensions::kExtensionScheme && |
781 #endif | 806 #endif |
782 scheme != content::kChromeDevToolsScheme); | 807 scheme != content::kChromeDevToolsScheme); |
783 } | 808 } |
OLD | NEW |