Commit 8f5d676f authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Migrate sync_ui_util to SyncUserSettings

SyncUserSettings is a new class that encapsulates all the
user-configurable knobs for Sync. It replaces a bunch of setters
and getters directly on the SyncService.

Bug: 884159
Change-Id: Iae8ac063b497ba4a74244d73927bc093cb42b57e
Reviewed-on: https://chromium-review.googlesource.com/c/1333387Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607619}
parent 0ef1b0d3
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/core/browser/signin_manager_base.h" #include "components/signin/core/browser/signin_manager_base.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync/protocol/sync_protocol_error.h" #include "components/sync/protocol/sync_protocol_error.h"
#include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/google_service_auth_error.h"
#include "services/identity/public/cpp/identity_manager.h" #include "services/identity/public/cpp/identity_manager.h"
...@@ -179,7 +178,7 @@ MessageType GetStatusInfo(Profile* profile, ...@@ -179,7 +178,7 @@ MessageType GetStatusInfo(Profile* profile,
if (!signin.IsAuthenticated()) if (!signin.IsAuthenticated())
return PRE_SYNCED; return PRE_SYNCED;
if (!service || service->IsFirstSetupComplete() || if (!service || service->GetUserSettings()->IsFirstSetupComplete() ||
service->HasDisableReason( service->HasDisableReason(
syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY) || syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY) ||
service->HasDisableReason( service->HasDisableReason(
...@@ -204,9 +203,8 @@ MessageType GetStatusInfo(Profile* profile, ...@@ -204,9 +203,8 @@ MessageType GetStatusInfo(Profile* profile,
return PRE_SYNCED; return PRE_SYNCED;
} }
PrefService* pref_service = profile->GetPrefs(); bool sync_everything =
syncer::SyncPrefs sync_prefs(pref_service); service->GetUserSettings()->IsSyncEverythingEnabled();
bool sync_everything = sync_prefs.HasKeepEverythingSynced();
// Check for sync errors if the sync service is enabled. // Check for sync errors if the sync service is enabled.
if (service) { if (service) {
...@@ -232,8 +230,8 @@ MessageType GetStatusInfo(Profile* profile, ...@@ -232,8 +230,8 @@ MessageType GetStatusInfo(Profile* profile,
} }
// Check for a passphrase error. // Check for a passphrase error.
if (service->IsPassphraseRequired() && if (service->GetUserSettings()->IsPassphraseRequired() &&
service->IsPassphraseRequiredForDecryption()) { service->GetUserSettings()->IsPassphraseRequiredForDecryption()) {
if (status_label && link_label) { if (status_label && link_label) {
status_label->assign( status_label->assign(
l10n_util::GetStringUTF16(IDS_SYNC_STATUS_NEEDS_PASSWORD)); l10n_util::GetStringUTF16(IDS_SYNC_STATUS_NEEDS_PASSWORD));
...@@ -426,8 +424,9 @@ MessageType GetStatus(Profile* profile, ...@@ -426,8 +424,9 @@ MessageType GetStatus(Profile* profile,
} }
bool ShouldShowPassphraseError(const ProfileSyncService* service) { bool ShouldShowPassphraseError(const ProfileSyncService* service) {
return service->IsFirstSetupComplete() && service->IsPassphraseRequired() && return service->GetUserSettings()->IsFirstSetupComplete() &&
service->IsPassphraseRequiredForDecryption(); service->GetUserSettings()->IsPassphraseRequired() &&
service->GetUserSettings()->IsPassphraseRequiredForDecryption();
} }
} // namespace sync_ui_util } // namespace sync_ui_util
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment