summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 20:33:11 +0000
committerchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 20:33:11 +0000
commit69a1f58a5d53946b7d2ed7afbd205b6ca05565a4 (patch)
treee60c2ac97207011f97dfb0174bd3acba9b66b6c4
parent390c7814321cb6708a6979daecd0c727c38b7695 (diff)
downloadchromium_src-69a1f58a5d53946b7d2ed7afbd205b6ca05565a4.zip
chromium_src-69a1f58a5d53946b7d2ed7afbd205b6ca05565a4.tar.gz
chromium_src-69a1f58a5d53946b7d2ed7afbd205b6ca05565a4.tar.bz2
Switch sync servers depending on whether you're running stable or dev. Initially just use the same url twice.
Review URL: http://codereview.chromium.org/2013017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47064 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/platform_util.h2
-rw-r--r--chrome/browser/sync/profile_sync_service.cc31
-rw-r--r--chrome/browser/sync/profile_sync_service.h6
-rw-r--r--chrome/browser/sync/profile_sync_service_unittest.cc6
4 files changed, 41 insertions, 4 deletions
diff --git a/chrome/browser/platform_util.h b/chrome/browser/platform_util.h
index 1f148f4..b75e7ff 100644
--- a/chrome/browser/platform_util.h
+++ b/chrome/browser/platform_util.h
@@ -43,7 +43,7 @@ void SimpleErrorBox(gfx::NativeWindow parent,
// Return a human readable modifier for the version string. For a
// branded Chrome (not Chromium), this modifier is the channel (dev,
-// beta, stable).
+// beta, but "" for stable).
string16 GetVersionStringModifier();
}
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index e4fb3d4..a1961cf 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -18,6 +18,7 @@
#include "base/task.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
@@ -42,8 +43,11 @@ using browser_sync::SyncBackendHost;
typedef GoogleServiceAuthError AuthError;
-// Default sync server URL.
-static const char kSyncServerUrl[] = "https://clients4.google.com/chrome-sync";
+const char* ProfileSyncService::kSyncServerUrl =
+ "https://clients4.google.com/chrome-sync";
+
+const char* ProfileSyncService::kDevServerUrl =
+ "https://clients4.google.com/chrome-sync";
ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory,
Profile* profile,
@@ -52,7 +56,7 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory,
factory_(factory),
profile_(profile),
bootstrap_sync_authentication_(bootstrap_sync_authentication),
- sync_service_url_(kSyncServerUrl),
+ sync_service_url_(kDevServerUrl),
backend_initialized_(false),
expecting_first_run_auth_needed_event_(false),
is_auth_in_progress_(false),
@@ -66,6 +70,25 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory,
registrar_.Add(this,
NotificationType::SYNC_CONFIGURE_DONE,
NotificationService::AllSources());
+
+ // By default, dev & chromium users will go to the development servers.
+ // Dev servers have more features than standard sync servers.
+ // Chrome stable and beta builds will go to the standard sync servers.
+#if defined(GOOGLE_CHROME_BUILD)
+ // For stable, this is "". For dev, this is "dev". For beta, this is "beta".
+ // For linux Chromium builds, this could be anything depending on the
+ // distribution, so always direct those users to dev server urls.
+ // If this is an official build, it will always be one of the above.
+ string16 channel = platform_util::GetVersionStringModifier();
+ if (channel == "" || channel == "beta") {
+ LOG(INFO) << "Detected official build, using official sync server.";
+ sync_service_url_ = kSyncServerUrl;
+ } else {
+ LOG(INFO) << "Detected official build, but using dev channel sync server.";
+ }
+#else
+ LOG(INFO) << "Unofficial build, using dev channel sync server.";
+#endif
}
ProfileSyncService::~ProfileSyncService() {
@@ -130,6 +153,8 @@ void ProfileSyncService::InitSettings() {
}
}
+ LOG(INFO) << "Using " << sync_service_url_ << " for sync server URL.";
+
if (command_line.HasSwitch(switches::kSyncNotificationMethod)) {
const std::string notification_method_str(
command_line.GetSwitchValueASCII(switches::kSyncNotificationMethod));
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index 86e3673..a1f04dd 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -117,6 +117,11 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
MAX_SYNC_EVENT_CODE
};
+ // Default sync server URL.
+ static const char* kSyncServerUrl;
+ // Sync server URL for dev channel users
+ static const char* kDevServerUrl;
+
ProfileSyncService(ProfileSyncFactory* factory_,
Profile* profile,
bool bootstrap_sync_authentication);
@@ -310,6 +315,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
friend class ProfileSyncServiceTest;
friend class ProfileSyncServicePreferenceTest;
friend class ProfileSyncServiceTestHarness;
+ FRIEND_TEST(ProfileSyncServiceTest, InitialState);
FRIEND_TEST(ProfileSyncServiceTest, UnrecoverableErrorSuspendsService);
// Initializes the various settings from the command line.
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index 7bd90c0..4645482 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -438,6 +438,12 @@ TEST_F(ProfileSyncServiceTest, InitialState) {
LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
StartSyncService();
+ EXPECT_TRUE(
+ service_->sync_service_url_.spec() ==
+ ProfileSyncService::kSyncServerUrl ||
+ service_->sync_service_url_.spec() ==
+ ProfileSyncService::kDevServerUrl);
+
EXPECT_TRUE(other_bookmarks_id());
EXPECT_TRUE(bookmark_bar_id());