Chromium Code Reviews| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 18 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 18 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 19 #include "chrome/browser/password_manager/password_store_factory.h" | 19 #include "chrome/browser/password_manager/password_store_factory.h" |
| 20 #include "chrome/browser/prerender/prerender_contents.h" | |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 23 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " | 24 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " |
| 24 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" | 25 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" |
| 25 #include "chrome/common/channel_info.h" | 26 #include "chrome/common/channel_info.h" |
| 26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/features.h" | 28 #include "chrome/common/features.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 #include "components/autofill/content/browser/content_autofill_driver.h" | 30 #include "components/autofill/content/browser/content_autofill_driver.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 IsFillingEnabledForCurrentPage(); | 206 IsFillingEnabledForCurrentPage(); |
| 206 } | 207 } |
| 207 | 208 |
| 208 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { | 209 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { |
| 209 return (!password_manager::IsSettingsBehaviorChangeActive() || | 210 return (!password_manager::IsSettingsBehaviorChangeActive() || |
| 210 *saving_and_filling_passwords_enabled_) && | 211 *saving_and_filling_passwords_enabled_) && |
| 211 !DidLastPageLoadEncounterSSLErrors() && | 212 !DidLastPageLoadEncounterSSLErrors() && |
| 212 IsPasswordManagementEnabledForCurrentPage(); | 213 IsPasswordManagementEnabledForCurrentPage(); |
| 213 } | 214 } |
| 214 | 215 |
| 216 bool ChromePasswordManagerClient::IsCredentialManagerEnabledForCurrentPage() { | |
|
pasko
2016/10/26 12:37:00
Naming this function by starting with "Is" suggest
vasilii
2016/10/27 09:02:08
Renamed. The password manager is a component. It s
| |
| 217 prerender::PrerenderContents* prerender_contents = | |
| 218 prerender::PrerenderContents::FromWebContents(web_contents()); | |
| 219 if (prerender_contents) { | |
| 220 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); | |
| 221 return false; | |
| 222 } | |
| 223 return true; | |
| 224 } | |
| 225 | |
| 215 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( | 226 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( |
| 216 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 227 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
| 217 password_manager::CredentialSourceType type, | 228 password_manager::CredentialSourceType type, |
| 218 bool update_password) { | 229 bool update_password) { |
| 219 // Save password infobar and the password bubble prompts in case of | 230 // Save password infobar and the password bubble prompts in case of |
| 220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 231 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 221 if (!BrowsingDataHelper::IsWebScheme( | 232 if (!BrowsingDataHelper::IsWebScheme( |
| 222 web_contents()->GetLastCommittedURL().scheme())) { | 233 web_contents()->GetLastCommittedURL().scheme())) { |
| 223 return false; | 234 return false; |
| 224 } | 235 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 ChromePasswordManagerClient::FromWebContents(web_contents); | 619 ChromePasswordManagerClient::FromWebContents(web_contents); |
| 609 | 620 |
| 610 // Try to bind to the driver, but if driver is not available for this render | 621 // Try to bind to the driver, but if driver is not available for this render |
| 611 // frame host, the request will be just dropped. This will cause the message | 622 // frame host, the request will be just dropped. This will cause the message |
| 612 // pipe to be closed, which will raise a connection error on the peer side. | 623 // pipe to be closed, which will raise a connection error on the peer side. |
| 613 if (!instance) | 624 if (!instance) |
| 614 return; | 625 return; |
| 615 | 626 |
| 616 instance->credential_manager_impl_.BindRequest(std::move(request)); | 627 instance->credential_manager_impl_.BindRequest(std::move(request)); |
| 617 } | 628 } |
| OLD | NEW |