| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 return password_manager_sync_metrics::IsSyncAccountCredential( | 143 return password_manager_sync_metrics::IsSyncAccountCredential( |
| 144 profile_, username, origin); | 144 profile_, username, origin); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ChromePasswordManagerClient::AutofillResultsComputed() { | 147 void ChromePasswordManagerClient::AutofillResultsComputed() { |
| 148 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered", | 148 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered", |
| 149 sync_credential_was_filtered_); | 149 sync_credential_was_filtered_); |
| 150 sync_credential_was_filtered_ = false; | 150 sync_credential_was_filtered_ = false; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void ChromePasswordManagerClient::PromptUserToSavePassword( | 153 bool ChromePasswordManagerClient::PromptUserToSavePassword( |
| 154 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { | 154 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { |
| 155 // Save password infobar and the password bubble prompts in case of | 155 // Save password infobar and the password bubble prompts in case of |
| 156 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 156 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 157 if (!BrowsingDataHelper::IsWebScheme( | 157 if (!BrowsingDataHelper::IsWebScheme( |
| 158 web_contents()->GetLastCommittedURL().scheme())) { | 158 web_contents()->GetLastCommittedURL().scheme())) { |
| 159 return; | 159 return false; |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (IsTheHotNewBubbleUIEnabled()) { | 162 if (IsTheHotNewBubbleUIEnabled()) { |
| 163 ManagePasswordsUIController* manage_passwords_ui_controller = | 163 ManagePasswordsUIController* manage_passwords_ui_controller = |
| 164 ManagePasswordsUIController::FromWebContents(web_contents()); | 164 ManagePasswordsUIController::FromWebContents(web_contents()); |
| 165 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); | 165 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); |
| 166 } else { | 166 } else { |
| 167 std::string uma_histogram_suffix( | 167 std::string uma_histogram_suffix( |
| 168 password_manager::metrics_util::GroupIdToString( | 168 password_manager::metrics_util::GroupIdToString( |
| 169 password_manager::metrics_util::MonitoredDomainGroupId( | 169 password_manager::metrics_util::MonitoredDomainGroupId( |
| 170 form_to_save->realm(), GetPrefs()))); | 170 form_to_save->realm(), GetPrefs()))); |
| 171 SavePasswordInfoBarDelegate::Create( | 171 SavePasswordInfoBarDelegate::Create( |
| 172 web_contents(), form_to_save.Pass(), uma_histogram_suffix); | 172 web_contents(), form_to_save.Pass(), uma_histogram_suffix); |
| 173 } | 173 } |
| 174 return true; |
| 174 } | 175 } |
| 175 | 176 |
| 176 void ChromePasswordManagerClient::AutomaticPasswordSave( | 177 void ChromePasswordManagerClient::AutomaticPasswordSave( |
| 177 scoped_ptr<password_manager::PasswordFormManager> saved_form) { | 178 scoped_ptr<password_manager::PasswordFormManager> saved_form) { |
| 178 if (IsTheHotNewBubbleUIEnabled()) { | 179 if (IsTheHotNewBubbleUIEnabled()) { |
| 179 ManagePasswordsUIController* manage_passwords_ui_controller = | 180 ManagePasswordsUIController* manage_passwords_ui_controller = |
| 180 ManagePasswordsUIController::FromWebContents(web_contents()); | 181 ManagePasswordsUIController::FromWebContents(web_contents()); |
| 181 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 182 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
| 182 saved_form.Pass()); | 183 saved_form.Pass()); |
| 183 } | 184 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 555 |
| 555 if (group_name == "DisallowSyncCredentialsForReauth") { | 556 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 556 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 557 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 557 } else if (group_name == "DisallowSyncCredentials") { | 558 } else if (group_name == "DisallowSyncCredentials") { |
| 558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 559 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 559 } else { | 560 } else { |
| 560 // Allow by default. | 561 // Allow by default. |
| 561 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 562 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 562 } | 563 } |
| 563 } | 564 } |
| OLD | NEW |