| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 prerender::PrerenderContents* prerender_contents = | 247 prerender::PrerenderContents* prerender_contents = |
| 248 prerender::PrerenderContents::FromWebContents(web_contents()); | 248 prerender::PrerenderContents::FromWebContents(web_contents()); |
| 249 if (prerender_contents) { | 249 if (prerender_contents) { |
| 250 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); | 250 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); |
| 251 return false; | 251 return false; |
| 252 } | 252 } |
| 253 return true; | 253 return true; |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( | 256 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( |
| 257 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 257 scoped_refptr<password_manager::PasswordFormManager> form_to_save, |
| 258 bool update_password) { | 258 bool update_password) { |
| 259 // Save password infobar and the password bubble prompts in case of | 259 // Save password infobar and the password bubble prompts in case of |
| 260 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 260 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 261 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) | 261 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 262 return false; | 262 return false; |
| 263 | 263 |
| 264 #if !defined(OS_ANDROID) | 264 #if !defined(OS_ANDROID) |
| 265 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 265 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 266 PasswordsClientUIDelegateFromWebContents(web_contents()); | 266 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 267 if (update_password) { | 267 if (update_password) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 possible_auto_sign_in_.reset(); | 367 possible_auto_sign_in_.reset(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void ChromePasswordManagerClient::NotifyStorePasswordCalled() { | 370 void ChromePasswordManagerClient::NotifyStorePasswordCalled() { |
| 371 // If a site stores a credential the autofill password manager shouldn't kick | 371 // If a site stores a credential the autofill password manager shouldn't kick |
| 372 // in. | 372 // in. |
| 373 password_manager_.DropFormManagers(); | 373 password_manager_.DropFormManagers(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void ChromePasswordManagerClient::AutomaticPasswordSave( | 376 void ChromePasswordManagerClient::AutomaticPasswordSave( |
| 377 std::unique_ptr<password_manager::PasswordFormManager> saved_form) { | 377 scoped_refptr<password_manager::PasswordFormManager> saved_form) { |
| 378 #if defined(OS_ANDROID) | 378 #if defined(OS_ANDROID) |
| 379 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 379 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
| 380 #else | 380 #else |
| 381 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 381 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 382 PasswordsClientUIDelegateFromWebContents(web_contents()); | 382 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 383 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 383 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
| 384 std::move(saved_form)); | 384 std::move(saved_form)); |
| 385 #endif | 385 #endif |
| 386 } | 386 } |
| 387 | 387 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // static | 713 // static |
| 714 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 714 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 715 std::string scheme = url.scheme(); | 715 std::string scheme = url.scheme(); |
| 716 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 716 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 717 scheme) && | 717 scheme) && |
| 718 #if BUILDFLAG(ENABLE_EXTENSIONS) | 718 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 719 scheme != extensions::kExtensionScheme && | 719 scheme != extensions::kExtensionScheme && |
| 720 #endif | 720 #endif |
| 721 scheme != content::kChromeDevToolsScheme); | 721 scheme != content::kChromeDevToolsScheme); |
| 722 } | 722 } |
| OLD | NEW |