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

Unified Diff: components/sync/driver/sync_service_base.cc

Issue 2710623003: [sync] Clean up path generation for the local sync database. (Closed)
Patch Set: Fix non-windows bots. Created 3 years, 10 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 | « components/sync/driver/sync_service_base.h ('k') | ios/chrome/browser/sync/ios_chrome_sync_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/sync_service_base.cc
diff --git a/components/sync/driver/sync_service_base.cc b/components/sync/driver/sync_service_base.cc
index ae7467a27669377aa084d4c896673fb9cde2f724..8da8c4b6893c34ca262781acf62c4834ac00e8c4 100644
--- a/components/sync/driver/sync_service_base.cc
+++ b/components/sync/driver/sync_service_base.cc
@@ -26,11 +26,6 @@ namespace {
const base::FilePath::CharType kSyncDataFolderName[] =
FILE_PATH_LITERAL("Sync Data");
-#if defined(OS_WIN)
-const base::FilePath::CharType kLoopbackServerBackendFilename[] =
- FILE_PATH_LITERAL("profile.pb");
-#endif
-
EngineComponentsFactory::Switches EngineSwitchesFromCommandLine() {
EngineComponentsFactory::Switches factory_switches = {
EngineComponentsFactory::ENCRYPTION_KEYSTORE,
@@ -124,8 +119,8 @@ void SyncServiceBase::InitializeEngine() {
// The first time we start up the engine we want to ensure we have a clean
// directory, so delete any old one that might be there.
params.delete_sync_data_folder = !IsFirstSetupComplete();
- params.enable_local_sync_backend =
- GetLocalSyncConfig(&params.local_sync_backend_folder);
+ params.enable_local_sync_backend = sync_prefs_.IsLocalSyncEnabled();
+ params.local_sync_backend_folder = sync_client_->GetLocalSyncBackendFolder();
params.restored_key_for_bootstrapping =
sync_prefs_.GetEncryptionBootstrapToken();
params.restored_keystore_key_for_bootstrapping =
@@ -142,40 +137,6 @@ void SyncServiceBase::InitializeEngine() {
engine_->Initialize(std::move(params));
}
-bool SyncServiceBase::GetLocalSyncConfig(
- base::FilePath* local_sync_backend_folder) const {
- bool enable_local_sync_backend = false;
- *local_sync_backend_folder = sync_prefs_.GetLocalSyncBackendDir();
-#if defined(OS_WIN)
- enable_local_sync_backend = sync_prefs_.IsLocalSyncEnabled();
- UMA_HISTOGRAM_BOOLEAN("Sync.Local.Enabled", enable_local_sync_backend);
- if (local_sync_backend_folder->empty()) {
- // TODO(pastarmovj): Add DIR_ROAMING_USER_DATA to PathService to simplify
- // this code and move the logic in its right place. See crbug/657810.
- if (!base::PathService::Get(base::DIR_APP_DATA,
- local_sync_backend_folder)) {
- SYSLOG(WARNING) << "Local sync can not get the roaming profile folder.";
- UMA_HISTOGRAM_BOOLEAN("Sync.Local.RoamingProfileUnavailable", false);
- return false;
- }
- *local_sync_backend_folder = local_sync_backend_folder->Append(
- FILE_PATH_LITERAL("Chrome/User Data"));
- }
- // This code as it is now will assume the same profile order is present on all
- // machines, which is not a given. It is to be defined if only the Default
- // profile should get this treatment or all profile as is the case now. The
- // solution for now will be to assume profiles are created in the same order
- // on all machines and in the future decide if only the Default one should be
- // considered roamed.
- // See http://crbug.com/674928.
- *local_sync_backend_folder =
- local_sync_backend_folder->Append(base_directory_.BaseName());
- *local_sync_backend_folder =
- local_sync_backend_folder->Append(kLoopbackServerBackendFilename);
-#endif // defined(OS_WIN)
- return enable_local_sync_backend;
-}
-
void SyncServiceBase::ResetCryptoState() {
crypto_ = base::MakeUnique<SyncServiceCrypto>(
base::BindRepeating(&SyncServiceBase::NotifyObservers,
« no previous file with comments | « components/sync/driver/sync_service_base.h ('k') | ios/chrome/browser/sync/ios_chrome_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698