Index: chrome/browser/sync/chrome_sync_client.cc |
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc |
index 295fdfb8744f2e644e06eb11f0344dbc64232807..6430bae7499269e01c5e26fc87ff9d39fe0f11d2 100644 |
--- a/chrome/browser/sync/chrome_sync_client.cc |
+++ b/chrome/browser/sync/chrome_sync_client.cc |
@@ -9,6 +9,8 @@ |
#include "base/bind.h" |
#include "base/command_line.h" |
#include "base/memory/ptr_util.h" |
+#include "base/path_service.h" |
+#include "base/syslog_logging.h" |
#include "build/build_config.h" |
#include "chrome/browser/autofill/personal_data_manager_factory.h" |
#include "chrome/browser/bookmarks/bookmark_model_factory.h" |
@@ -34,6 +36,7 @@ |
#include "chrome/browser/undo/bookmark_undo_service_factory.h" |
#include "chrome/browser/web_data_service_factory.h" |
#include "chrome/common/channel_info.h" |
+#include "chrome/common/chrome_paths.h" |
#include "chrome/common/features.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
@@ -55,6 +58,7 @@ |
#include "components/search_engines/search_engine_data_type_controller.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
#include "components/spellcheck/spellcheck_build_features.h" |
+#include "components/sync/base/pref_names.h" |
#include "components/sync/base/report_unrecoverable_error.h" |
#include "components/sync/driver/async_directory_type_controller.h" |
#include "components/sync/driver/sync_api_component_factory.h" |
@@ -123,6 +127,13 @@ using syncer::AsyncDirectoryTypeController; |
namespace browser_sync { |
+namespace { |
+#if defined(OS_WIN) |
+const base::FilePath::CharType kLoopbackServerBackendFilename[] = |
+ FILE_PATH_LITERAL("profile.pb"); |
+#endif |
+} // namespace |
+ |
// Chrome implementation of SyncSessionsClient. Needs to be in a separate class |
// due to possible multiple inheritance issues, wherein ChromeSyncClient might |
// inherit from other interfaces with same methods. |
@@ -235,6 +246,35 @@ PrefService* ChromeSyncClient::GetPrefService() { |
return profile_->GetPrefs(); |
} |
+base::FilePath ChromeSyncClient::GetLocalSyncBackendFolder() { |
+ base::FilePath local_sync_backend_folder = |
+ GetPrefService()->GetFilePath(syncer::prefs::kLocalSyncBackendDir); |
+ |
+#if defined(OS_WIN) |
+ if (local_sync_backend_folder.empty()) { |
+ if (!base::PathService::Get(chrome::DIR_ROAMING_USER_DATA, |
+ &local_sync_backend_folder)) { |
+ SYSLOG(WARNING) << "Local sync can not get the roaming profile folder."; |
+ return base::FilePath(); |
+ } |
+ } |
+ |
+ // 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. |
+ // TODO(pastarmovj): http://crbug.com/674928 Decide if only the Default one |
+ // should be considered roamed. For now the code assumes all profiles are |
+ // created in the same order on all machines. |
+ local_sync_backend_folder = |
+ local_sync_backend_folder.Append(profile_->GetPath().BaseName()); |
+ local_sync_backend_folder = |
+ local_sync_backend_folder.Append(kLoopbackServerBackendFilename); |
+#endif // defined(OS_WIN) |
+ |
+ return local_sync_backend_folder; |
+} |
+ |
bookmarks::BookmarkModel* ChromeSyncClient::GetBookmarkModel() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
return BookmarkModelFactory::GetForBrowserContext(profile_); |