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

Unified Diff: chrome/browser/autofill/options_util.cc

Issue 1137513002: Autofill: Add WalletIntegrationAvailable() to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Change pointer params to const ref. Add newline. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/options_util.cc
diff --git a/chrome/browser/autofill/options_util.cc b/chrome/browser/autofill/options_util.cc
index 389d40e44beeee39ddb5f535469fe67f4b4c8a45..e19b78f345187d6e21a80eaebabf0b6ccbaee26f 100644
--- a/chrome/browser/autofill/options_util.cc
+++ b/chrome/browser/autofill/options_util.cc
@@ -4,39 +4,18 @@
#include "chrome/browser/autofill/options_util.h"
-#include "base/prefs/pref_service.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "components/autofill/core/browser/personal_data_manager.h"
-#include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/autofill/core/browser/options_util.h"
namespace autofill {
bool WalletIntegrationAvailableForProfile(Profile* profile) {
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
- if (!(service && service->IsSyncEnabledAndLoggedIn() &&
- service->GetPreferredDataTypes().Has(syncer::AUTOFILL_PROFILE))) {
- return false;
- }
-
- PersonalDataManager* pdm = PersonalDataManagerFactory::GetForProfile(profile);
- if (!pdm->IsExperimentalWalletIntegrationEnabled())
- return false;
-
- // If the user is signed in and the feature is enabled, but no data is being
- // synced, hide the option. The user doesn't have a Wallet account. If the
- // feature is disabled, we can't know, so show the checkbox.
- if (!profile->GetPrefs()->GetBoolean(prefs::kAutofillWalletImportEnabled))
Evan Stade 2015/05/11 18:00:38 you inverted this check
- return true;
-
- // If wallet is preferred but we haven't gotten the sync data yet, we don't
- // know, so show the checkbox.
- if (!service->GetActiveDataTypes().Has(syncer::AUTOFILL_WALLET_DATA))
- return true;
-
- return pdm->HasServerData();
+ return WalletIntegrationAvailable(
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile),
+ *profile->GetPrefs(),
+ *PersonalDataManagerFactory::GetForProfile(profile));
bondd 2015/05/07 21:19:24 LMK if you want me to DCHECK prefs and profile bef
Evan Stade 2015/05/07 21:23:02 DCHECK is just documentation that you expect somet
}
} // namespace autofill
« no previous file with comments | « no previous file | components/autofill.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698