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

Unified Diff: chrome/browser/sync/chrome_sync_client.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 | « chrome/browser/sync/chrome_sync_client.h ('k') | chrome/browser/sync/profile_sync_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.h ('k') | chrome/browser/sync/profile_sync_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698