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

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

Issue 789613004: Decision whenever "Allow to collect URL?" bubble should be shown or not (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes which belong to this CL. Created 6 years 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
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/browser_process.h"
13 #include "chrome/browser/browsing_data/browsing_data_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_helper.h"
14 #include "chrome/browser/password_manager/password_manager_util.h" 15 #include "chrome/browser/password_manager/password_manager_util.h"
15 #include "chrome/browser/password_manager/password_store_factory.h" 16 #include "chrome/browser/password_manager/password_store_factory.h"
16 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" 17 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
17 #include "chrome/browser/password_manager/sync_metrics.h" 18 #include "chrome/browser/password_manager/sync_metrics.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h" 21 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 22 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
22 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 23 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/chrome_version_info.h" 25 #include "chrome/common/chrome_version_info.h"
25 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
26 #include "components/autofill/content/browser/content_autofill_driver.h" 27 #include "components/autofill/content/browser/content_autofill_driver.h"
27 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 28 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
28 #include "components/autofill/content/common/autofill_messages.h" 29 #include "components/autofill/content/common/autofill_messages.h"
29 #include "components/autofill/core/browser/password_generator.h" 30 #include "components/autofill/core/browser/password_generator.h"
30 #include "components/autofill/core/common/password_form.h" 31 #include "components/autofill/core/common/password_form.h"
32 #include "components/metrics/metrics_service.h"
31 #include "components/password_manager/content/browser/content_password_manager_d river.h" 33 #include "components/password_manager/content/browser/content_password_manager_d river.h"
32 #include "components/password_manager/content/browser/password_manager_internals _service_factory.h" 34 #include "components/password_manager/content/browser/password_manager_internals _service_factory.h"
33 #include "components/password_manager/content/common/credential_manager_messages .h" 35 #include "components/password_manager/content/common/credential_manager_messages .h"
34 #include "components/password_manager/content/common/credential_manager_types.h" 36 #include "components/password_manager/content/common/credential_manager_types.h"
35 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" 37 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h"
36 #include "components/password_manager/core/browser/log_receiver.h" 38 #include "components/password_manager/core/browser/log_receiver.h"
37 #include "components/password_manager/core/browser/password_form_manager.h" 39 #include "components/password_manager/core/browser/password_form_manager.h"
38 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" 40 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h"
39 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 41 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
40 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h" 42 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (EnabledForSyncSignin()) 148 if (EnabledForSyncSignin())
147 return true; 149 return true;
148 150
149 // Do not fill nor save password when a user is signing in for sync. This 151 // Do not fill nor save password when a user is signing in for sync. This
150 // is because users need to remember their password if they are syncing as 152 // is because users need to remember their password if they are syncing as
151 // this is effectively their master password. 153 // this is effectively their master password.
152 return entry->GetURL().host() != chrome::kChromeUIChromeSigninHost; 154 return entry->GetURL().host() != chrome::kChromeUIChromeSigninHost;
153 } 155 }
154 156
155 bool ChromePasswordManagerClient::ShouldAskUserToSubmitURL(const GURL& url) { 157 bool ChromePasswordManagerClient::ShouldAskUserToSubmitURL(const GURL& url) {
156 return url.is_valid() && !url.is_empty() && url.has_host() && 158 if (url.is_valid() && !url.is_empty() && url.has_host()) {
157 password_manager::urls_collection_experiment::ShouldShowBubble( 159 std::stringstream profile_uuid_stream;
vabr (Chromium) 2014/12/10 18:19:54 The style guide forbids streams (except for loggin
melandory 2014/12/11 08:37:38 Done.
158 GetPrefs()); 160 profile_uuid_stream << profile_->GetProfileName();
161 profile_uuid_stream
162 << g_browser_process->metrics_service()->GetInstallDate();
163 return password_manager::urls_collection_experiment::ShouldShowBubble(
164 GetPrefs(), profile_uuid_stream.str());
165 }
166 return false;
159 } 167 }
160 168
161 bool ChromePasswordManagerClient::ShouldFilterAutofillResult( 169 bool ChromePasswordManagerClient::ShouldFilterAutofillResult(
162 const autofill::PasswordForm& form) { 170 const autofill::PasswordForm& form) {
163 if (!IsSyncAccountCredential(base::UTF16ToUTF8(form.username_value), 171 if (!IsSyncAccountCredential(base::UTF16ToUTF8(form.username_value),
164 form.signon_realm)) 172 form.signon_realm))
165 return false; 173 return false;
166 174
167 if (autofill_sync_state_ == DISALLOW_SYNC_CREDENTIALS) { 175 if (autofill_sync_state_ == DISALLOW_SYNC_CREDENTIALS) {
168 sync_credential_was_filtered_ = true; 176 sync_credential_was_filtered_ = true;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 581
574 if (group_name == "DisallowSyncCredentialsForReauth") { 582 if (group_name == "DisallowSyncCredentialsForReauth") {
575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; 583 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
576 } else if (group_name == "DisallowSyncCredentials") { 584 } else if (group_name == "DisallowSyncCredentials") {
577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 585 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
578 } else { 586 } else {
579 // Allow by default. 587 // Allow by default.
580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 588 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
581 } 589 }
582 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698