| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" | 43 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" |
| 44 #include "components/password_manager/core/browser/password_manager_util.h" | 44 #include "components/password_manager/core/browser/password_manager_util.h" |
| 45 #include "components/password_manager/core/common/credential_manager_types.h" | 45 #include "components/password_manager/core/common/credential_manager_types.h" |
| 46 #include "components/password_manager/core/common/password_manager_features.h" | 46 #include "components/password_manager/core/common/password_manager_features.h" |
| 47 #include "components/password_manager/core/common/password_manager_pref_names.h" | 47 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 48 #include "components/password_manager/sync/browser/password_sync_util.h" | 48 #include "components/password_manager/sync/browser/password_sync_util.h" |
| 49 #include "components/prefs/pref_service.h" | 49 #include "components/prefs/pref_service.h" |
| 50 #include "components/sessions/content/content_record_password_state.h" | 50 #include "components/sessions/content/content_record_password_state.h" |
| 51 #include "components/signin/core/browser/signin_manager.h" | 51 #include "components/signin/core/browser/signin_manager.h" |
| 52 #include "components/version_info/version_info.h" | 52 #include "components/version_info/version_info.h" |
| 53 #include "content/public/browser/child_process_security_policy.h" |
| 53 #include "content/public/browser/navigation_entry.h" | 54 #include "content/public/browser/navigation_entry.h" |
| 54 #include "content/public/browser/render_view_host.h" | 55 #include "content/public/browser/render_view_host.h" |
| 55 #include "content/public/browser/ssl_status.h" | 56 #include "content/public/browser/ssl_status.h" |
| 56 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
| 58 #include "extensions/features/features.h" |
| 57 #include "google_apis/gaia/gaia_urls.h" | 59 #include "google_apis/gaia/gaia_urls.h" |
| 58 #include "net/base/url_util.h" | 60 #include "net/base/url_util.h" |
| 59 #include "third_party/re2/src/re2/re2.h" | 61 #include "third_party/re2/src/re2/re2.h" |
| 60 | 62 |
| 61 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
| 62 #include "chrome/browser/android/tab_android.h" | 64 #include "chrome/browser/android/tab_android.h" |
| 63 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 65 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 64 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" | 66 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" |
| 65 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 67 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 66 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" | 68 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
| 67 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 69 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
| 68 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 70 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| 69 #endif | 71 #endif |
| 70 | 72 |
| 73 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 74 #include "extensions/common/constants.h" |
| 75 #endif |
| 76 |
| 71 using password_manager::ContentPasswordManagerDriverFactory; | 77 using password_manager::ContentPasswordManagerDriverFactory; |
| 72 using password_manager::PasswordManagerInternalsService; | 78 using password_manager::PasswordManagerInternalsService; |
| 73 using sessions::SerializedNavigationEntry; | 79 using sessions::SerializedNavigationEntry; |
| 74 | 80 |
| 75 // Shorten the name to spare line breaks. The code provides enough context | 81 // Shorten the name to spare line breaks. The code provides enough context |
| 76 // already. | 82 // already. |
| 77 typedef autofill::SavePasswordProgressLogger Logger; | 83 typedef autofill::SavePasswordProgressLogger Logger; |
| 78 | 84 |
| 79 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 85 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 80 | 86 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 230 } |
| 225 return true; | 231 return true; |
| 226 } | 232 } |
| 227 | 233 |
| 228 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( | 234 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( |
| 229 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 235 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
| 230 password_manager::CredentialSourceType type, | 236 password_manager::CredentialSourceType type, |
| 231 bool update_password) { | 237 bool update_password) { |
| 232 // Save password infobar and the password bubble prompts in case of | 238 // Save password infobar and the password bubble prompts in case of |
| 233 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 239 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 234 if (!BrowsingDataHelper::IsWebScheme( | 240 if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) |
| 235 web_contents()->GetLastCommittedURL().scheme())) { | |
| 236 return false; | 241 return false; |
| 237 } | |
| 238 | 242 |
| 239 #if !defined(OS_ANDROID) | 243 #if !defined(OS_ANDROID) |
| 240 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 244 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 241 PasswordsClientUIDelegateFromWebContents(web_contents()); | 245 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 242 if (update_password) { | 246 if (update_password) { |
| 243 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( | 247 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( |
| 244 std::move(form_to_save)); | 248 std::move(form_to_save)); |
| 245 } else { | 249 } else { |
| 246 manage_passwords_ui_controller->OnPasswordSubmitted( | 250 manage_passwords_ui_controller->OnPasswordSubmitted( |
| 247 std::move(form_to_save)); | 251 std::move(form_to_save)); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 ChromePasswordManagerClient::FromWebContents(web_contents); | 639 ChromePasswordManagerClient::FromWebContents(web_contents); |
| 636 | 640 |
| 637 // Try to bind to the driver, but if driver is not available for this render | 641 // Try to bind to the driver, but if driver is not available for this render |
| 638 // frame host, the request will be just dropped. This will cause the message | 642 // frame host, the request will be just dropped. This will cause the message |
| 639 // pipe to be closed, which will raise a connection error on the peer side. | 643 // pipe to be closed, which will raise a connection error on the peer side. |
| 640 if (!instance) | 644 if (!instance) |
| 641 return; | 645 return; |
| 642 | 646 |
| 643 instance->credential_manager_impl_.BindRequest(std::move(request)); | 647 instance->credential_manager_impl_.BindRequest(std::move(request)); |
| 644 } | 648 } |
| 649 |
| 650 // static |
| 651 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 652 std::string scheme = url.scheme(); |
| 653 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 654 scheme) && |
| 655 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 656 scheme != extensions::kExtensionScheme && |
| 657 #endif |
| 658 scheme != content::kChromeDevToolsScheme); |
| 659 } |
| OLD | NEW |