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 has_generated_password, |
| 302 bool is_update) { |
| 303 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 304 return; |
| 305 |
| 306 #if !defined(OS_ANDROID) |
| 307 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 308 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 309 manage_passwords_ui_controller->OnShowManualFallbackForSaving( |
| 310 std::move(form_to_save), has_generated_password, is_update); |
| 311 #endif // !defined(OS_ANDROID) |
| 312 } |
| 313 |
| 314 void ChromePasswordManagerClient::HideManualFallbackForSaving() { |
| 315 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 316 return; |
| 317 |
| 318 #if !defined(OS_ANDROID) |
| 319 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 320 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 321 manage_passwords_ui_controller->OnHideManualFallbackForSaving(); |
| 322 #endif // !defined(OS_ANDROID) |
| 323 } |
| 324 |
299 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 325 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
300 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 326 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
301 const GURL& origin, | 327 const GURL& origin, |
302 const CredentialsCallback& callback) { | 328 const CredentialsCallback& callback) { |
303 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one | 329 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one |
304 // form provided). | 330 // form provided). |
305 CredentialsCallback intercept = | 331 CredentialsCallback intercept = |
306 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, | 332 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, |
307 base::Unretained(this), callback, local_forms.size() == 1); | 333 base::Unretained(this), callback, local_forms.size() == 1); |
308 #if defined(OS_ANDROID) | 334 #if defined(OS_ANDROID) |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 // static | 804 // static |
779 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 805 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
780 std::string scheme = url.scheme(); | 806 std::string scheme = url.scheme(); |
781 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 807 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
782 scheme) && | 808 scheme) && |
783 #if BUILDFLAG(ENABLE_EXTENSIONS) | 809 #if BUILDFLAG(ENABLE_EXTENSIONS) |
784 scheme != extensions::kExtensionScheme && | 810 scheme != extensions::kExtensionScheme && |
785 #endif | 811 #endif |
786 scheme != content::kChromeDevToolsScheme); | 812 scheme != content::kChromeDevToolsScheme); |
787 } | 813 } |
OLD | NEW |