| Index: chrome/browser/password_manager/chrome_password_manager_client.cc
|
| diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
| index d32389efb36f94dd7f82d746b88dc4b5b03c304f..ea7ff6a0ed7d81ec49dd0200848d9ea6d33fdf24 100644
|
| --- a/chrome/browser/password_manager/chrome_password_manager_client.cc
|
| +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
| @@ -40,6 +40,7 @@
|
| #include "components/password_manager/core/common/credential_manager_types.h"
|
| #include "components/password_manager/core/common/password_manager_pref_names.h"
|
| #include "components/password_manager/core/common/password_manager_switches.h"
|
| +#include "components/password_manager/sync/browser/sync_store_result_filter.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -111,9 +112,7 @@ ChromePasswordManagerClient::ChromePasswordManagerClient(
|
| driver_factory_(nullptr),
|
| credential_manager_dispatcher_(web_contents, this),
|
| observer_(nullptr),
|
| - can_use_log_router_(false),
|
| - autofill_sync_state_(ALLOW_SYNC_CREDENTIALS),
|
| - sync_credential_was_filtered_(false) {
|
| + can_use_log_router_(false) {
|
| ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this,
|
| autofill_client);
|
| driver_factory_ =
|
| @@ -123,7 +122,6 @@ ChromePasswordManagerClient::ChromePasswordManagerClient(
|
| PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
|
| if (service)
|
| can_use_log_router_ = service->RegisterClient(this);
|
| - SetUpAutofillSyncState();
|
| saving_passwords_enabled_.Init(
|
| password_manager::prefs::kPasswordManagerSavingEnabled, GetPrefs());
|
| ReportMetrics(*saving_passwords_enabled_, this);
|
| @@ -178,26 +176,6 @@ bool ChromePasswordManagerClient::IsSavingEnabledForCurrentPage() const {
|
| IsPasswordManagementEnabledForCurrentPage();
|
| }
|
|
|
| -bool ChromePasswordManagerClient::ShouldFilterAutofillResult(
|
| - const autofill::PasswordForm& form) {
|
| - if (!IsSyncAccountCredential(base::UTF16ToUTF8(form.username_value),
|
| - form.signon_realm))
|
| - return false;
|
| -
|
| - if (autofill_sync_state_ == DISALLOW_SYNC_CREDENTIALS) {
|
| - sync_credential_was_filtered_ = true;
|
| - return true;
|
| - }
|
| -
|
| - if (autofill_sync_state_ == DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH &&
|
| - LastLoadWasTransactionalReauthPage()) {
|
| - sync_credential_was_filtered_ = true;
|
| - return true;
|
| - }
|
| -
|
| - return false;
|
| -}
|
| -
|
| std::string ChromePasswordManagerClient::GetSyncUsername() const {
|
| return password_manager_sync_metrics::GetSyncUsername(profile_);
|
| }
|
| @@ -209,12 +187,6 @@ bool ChromePasswordManagerClient::IsSyncAccountCredential(
|
| profile_, username, realm);
|
| }
|
|
|
| -void ChromePasswordManagerClient::AutofillResultsComputed() {
|
| - UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered",
|
| - sync_credential_was_filtered_);
|
| - sync_credential_was_filtered_ = false;
|
| -}
|
| -
|
| bool ChromePasswordManagerClient::PromptUserToSavePassword(
|
| scoped_ptr<password_manager::PasswordFormManager> form_to_save,
|
| password_manager::CredentialSourceType type) {
|
| @@ -481,24 +453,6 @@ void ChromePasswordManagerClient::NotifyRendererOfLoggingAvailability() {
|
| can_use_log_router_));
|
| }
|
|
|
| -bool ChromePasswordManagerClient::LastLoadWasTransactionalReauthPage() const {
|
| - DCHECK(web_contents());
|
| - content::NavigationEntry* entry =
|
| - web_contents()->GetController().GetLastCommittedEntry();
|
| - if (!entry)
|
| - return false;
|
| -
|
| - if (entry->GetURL().GetOrigin() !=
|
| - GaiaUrls::GetInstance()->gaia_url().GetOrigin())
|
| - return false;
|
| -
|
| - // "rart" is the transactional reauth paramter.
|
| - std::string ignored_value;
|
| - return net::GetValueForKeyInQuery(entry->GetURL(),
|
| - "rart",
|
| - &ignored_value);
|
| -}
|
| -
|
| bool ChromePasswordManagerClient::IsURLPasswordWebsiteReauth(
|
| const GURL& url) const {
|
| if (url.GetOrigin() != GaiaUrls::GetInstance()->gaia_url().GetOrigin())
|
| @@ -556,38 +510,21 @@ bool ChromePasswordManagerClient::EnabledForSyncSignin() {
|
| return group_name != "Disabled";
|
| }
|
|
|
| -void ChromePasswordManagerClient::SetUpAutofillSyncState() {
|
| - std::string group_name =
|
| - base::FieldTrialList::FindFullName("AutofillSyncCredential");
|
| +const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
|
| + return web_contents()->GetVisibleURL();
|
| +}
|
|
|
| - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| - if (command_line->HasSwitch(
|
| - password_manager::switches::kAllowAutofillSyncCredential)) {
|
| - autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
|
| - return;
|
| - }
|
| - if (command_line->HasSwitch(
|
| - password_manager::switches::
|
| - kDisallowAutofillSyncCredentialForReauth)) {
|
| - autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
|
| - return;
|
| - }
|
| - if (command_line->HasSwitch(
|
| - password_manager::switches::kDisallowAutofillSyncCredential)) {
|
| - autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
|
| - return;
|
| - }
|
| +const GURL& ChromePasswordManagerClient::GetLastCommittedEntryURL() const {
|
| + DCHECK(web_contents());
|
| + content::NavigationEntry* entry =
|
| + web_contents()->GetController().GetLastCommittedEntry();
|
| + if (!entry)
|
| + return GURL::EmptyGURL();
|
|
|
| - if (group_name == "DisallowSyncCredentialsForReauth") {
|
| - autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
|
| - } else if (group_name == "DisallowSyncCredentials") {
|
| - autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
|
| - } else {
|
| - // Allow by default.
|
| - autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
|
| - }
|
| + return entry->GetURL();
|
| }
|
|
|
| -const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
|
| - return web_contents()->GetVisibleURL();
|
| +scoped_ptr<password_manager::StoreResultFilter>
|
| +ChromePasswordManagerClient::CreateStoreResultFilter() const {
|
| + return make_scoped_ptr(new password_manager::SyncStoreResultFilter(this));
|
| }
|
|
|