Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 582833005: Save password infobar should only work on schemes on which the bubble does (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing with Nits addressed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/browsing_data/browsing_data_helper.h"
13 #include "chrome/browser/password_manager/password_manager_util.h" 14 #include "chrome/browser/password_manager/password_manager_util.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 15 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" 16 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
16 #include "chrome/browser/password_manager/sync_metrics.h" 17 #include "chrome/browser/password_manager/sync_metrics.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/sync/profile_sync_service.h" 19 #include "chrome/browser/sync/profile_sync_service.h"
19 #include "chrome/browser/sync/profile_sync_service_factory.h" 20 #include "chrome/browser/sync/profile_sync_service_factory.h"
20 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 21 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
21 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 22 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
22 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 145
145 void ChromePasswordManagerClient::AutofillResultsComputed() { 146 void ChromePasswordManagerClient::AutofillResultsComputed() {
146 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered", 147 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered",
147 sync_credential_was_filtered_); 148 sync_credential_was_filtered_);
148 sync_credential_was_filtered_ = false; 149 sync_credential_was_filtered_ = false;
149 } 150 }
150 151
151 void ChromePasswordManagerClient::PromptUserToSavePassword( 152 void ChromePasswordManagerClient::PromptUserToSavePassword(
152 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { 153 scoped_ptr<password_manager::PasswordFormManager> form_to_save) {
154 // Save password infobar and the password bubble prompts in case of
155 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://).
156 if (!BrowsingDataHelper::IsWebScheme(
157 web_contents()->GetLastCommittedURL().scheme())) {
158 return;
159 }
160
153 if (IsTheHotNewBubbleUIEnabled()) { 161 if (IsTheHotNewBubbleUIEnabled()) {
154 ManagePasswordsUIController* manage_passwords_ui_controller = 162 ManagePasswordsUIController* manage_passwords_ui_controller =
155 ManagePasswordsUIController::FromWebContents(web_contents()); 163 ManagePasswordsUIController::FromWebContents(web_contents());
156 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); 164 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass());
157 } else { 165 } else {
158 std::string uma_histogram_suffix( 166 std::string uma_histogram_suffix(
159 password_manager::metrics_util::GroupIdToString( 167 password_manager::metrics_util::GroupIdToString(
160 password_manager::metrics_util::MonitoredDomainGroupId( 168 password_manager::metrics_util::MonitoredDomainGroupId(
161 form_to_save->realm(), GetPrefs()))); 169 form_to_save->realm(), GetPrefs())));
162 SavePasswordInfoBarDelegate::Create( 170 SavePasswordInfoBarDelegate::Create(
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 550
543 if (group_name == "DisallowSyncCredentialsForReauth") { 551 if (group_name == "DisallowSyncCredentialsForReauth") {
544 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; 552 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
545 } else if (group_name == "DisallowSyncCredentials") { 553 } else if (group_name == "DisallowSyncCredentials") {
546 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 554 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
547 } else { 555 } else {
548 // Allow by default. 556 // Allow by default.
549 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 557 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
550 } 558 }
551 } 559 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698