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 return true; | |
vabr (Chromium)
2014/09/26 15:39:47
Just keep one "return true;" after the whole if-el
Sunil Ratnu
2014/09/26 16:01:20
Done.
| |
166 } else { | 167 } else { |
167 std::string uma_histogram_suffix( | 168 std::string uma_histogram_suffix( |
168 password_manager::metrics_util::GroupIdToString( | 169 password_manager::metrics_util::GroupIdToString( |
169 password_manager::metrics_util::MonitoredDomainGroupId( | 170 password_manager::metrics_util::MonitoredDomainGroupId( |
170 form_to_save->realm(), GetPrefs()))); | 171 form_to_save->realm(), GetPrefs()))); |
171 SavePasswordInfoBarDelegate::Create( | 172 SavePasswordInfoBarDelegate::Create( |
172 web_contents(), form_to_save.Pass(), uma_histogram_suffix); | 173 web_contents(), form_to_save.Pass(), uma_histogram_suffix); |
174 return true; | |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 void ChromePasswordManagerClient::AutomaticPasswordSave( | 178 void ChromePasswordManagerClient::AutomaticPasswordSave( |
177 scoped_ptr<password_manager::PasswordFormManager> saved_form) { | 179 scoped_ptr<password_manager::PasswordFormManager> saved_form) { |
178 if (IsTheHotNewBubbleUIEnabled()) { | 180 if (IsTheHotNewBubbleUIEnabled()) { |
179 ManagePasswordsUIController* manage_passwords_ui_controller = | 181 ManagePasswordsUIController* manage_passwords_ui_controller = |
180 ManagePasswordsUIController::FromWebContents(web_contents()); | 182 ManagePasswordsUIController::FromWebContents(web_contents()); |
181 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 183 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
182 saved_form.Pass()); | 184 saved_form.Pass()); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 | 556 |
555 if (group_name == "DisallowSyncCredentialsForReauth") { | 557 if (group_name == "DisallowSyncCredentialsForReauth") { |
556 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
557 } else if (group_name == "DisallowSyncCredentials") { | 559 } else if (group_name == "DisallowSyncCredentials") { |
558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 560 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
559 } else { | 561 } else { |
560 // Allow by default. | 562 // Allow by default. |
561 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 563 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
562 } | 564 } |
563 } | 565 } |
OLD | NEW |