summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoralbertb@google.com <albertb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:13:30 +0000
committeralbertb@google.com <albertb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:13:30 +0000
commit595fbb4e449423faa19cbf9533d980bd2b100479 (patch)
tree4832d181a320fa696df9223348cdf9bd618e9aa5 /chrome
parent281e32a4405d515657c156d240b777d5a1cbb031 (diff)
downloadchromium_src-595fbb4e449423faa19cbf9533d980bd2b100479.zip
chromium_src-595fbb4e449423faa19cbf9533d980bd2b100479.tar.gz
chromium_src-595fbb4e449423faa19cbf9533d980bd2b100479.tar.bz2
Update the kHasSyncSetupCompleted preference when the bootstraped
authentication is succesful in Chrome OS. BUG=1220 TEST=The menu option in the wrench menu should indicate that bookmarks are synced on startup, and it should be possible to disable sync through the options dialog. Review URL: http://codereview.chromium.org/551053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/defaults.cc2
-rw-r--r--chrome/browser/defaults.h4
-rw-r--r--chrome/browser/sync/profile_sync_service.cc48
3 files changed, 32 insertions, 22 deletions
diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc
index dee5bc5..a901949 100644
--- a/chrome/browser/defaults.cc
+++ b/chrome/browser/defaults.cc
@@ -23,6 +23,7 @@ const bool kShowAboutMenuItem = true;
const bool kOSSupportsOtherBrowsers = false;
const bool kDownloadPageHasShowInFolder = false;
const bool kSizeTabButtonToTopOfTabStrip = true;
+const bool kBootstrapSyncAuthentication = true;
#elif defined(OS_LINUX)
@@ -61,6 +62,7 @@ const bool kShowAboutMenuItem = true;
#endif
const bool kOSSupportsOtherBrowsers = true;
const bool kSizeTabButtonToTopOfTabStrip = false;
+const bool kBootstrapSyncAuthentication = false;
#endif
diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h
index 7ab2b64..595bb70 100644
--- a/chrome/browser/defaults.h
+++ b/chrome/browser/defaults.h
@@ -60,6 +60,10 @@ extern const bool kDownloadPageHasShowInFolder;
// Should the tab strip be sized to the top of the tab strip?
extern const bool kSizeTabButtonToTopOfTabStrip;
+// Whether we should bootstrap the sync authentication using cookies instead of
+// asking the user for credentials.
+extern const bool kBootstrapSyncAuthentication;
+
} // namespace browser_defaults
#endif // CHROME_BROWSER_DEFAULTS_H_
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 5f7a203..e2a6c09 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -16,6 +16,7 @@
#include "base/string_util.h"
#include "base/time.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
+#include "chrome/browser/defaults.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/profile.h"
@@ -66,10 +67,9 @@ void ProfileSyncService::Initialize() {
if (!profile()->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) {
DisableForUser(); // Clean up in case of previous crash / setup abort.
-#if defined(OS_CHROMEOS)
- if (profile()->GetRequestContext())
+ if (browser_defaults::kBootstrapSyncAuthentication &&
+ profile()->GetRequestContext())
StartUp(); // We always start sync for Chrome OS.
-#endif
} else {
StartUp();
}
@@ -111,29 +111,27 @@ void ProfileSyncService::ClearPreferences() {
pref_service->ScheduleSavePersistentPrefs();
}
-#if defined(OS_CHROMEOS)
// The domain and name of the LSID cookie which we use to bootstrap the sync
// authentication in Chrome OS.
const char kLsidCookieDomain[] = "www.google.com";
const char kLsidCookieName[] = "LSID";
-#endif
std::string ProfileSyncService::GetLsidForAuthBootstraping() {
-#if defined(OS_CHROMEOS)
- // If we're running inside Chrome OS, bootstrap the sync authentication by
- // using the LSID cookie provided by the Chrome OS login manager.
- net::CookieMonster::CookieList cookies = profile()->GetRequestContext()->
- GetCookieStore()->GetCookieMonster()->GetAllCookies();
- for (net::CookieMonster::CookieList::const_iterator it = cookies.begin();
- it != cookies.end(); ++it) {
- if (kLsidCookieDomain == it->first) {
- const net::CookieMonster::CanonicalCookie& cookie = it->second;
- if (kLsidCookieName == cookie.Name()) {
- return cookie.Value();
+ if (browser_defaults::kBootstrapSyncAuthentication) {
+ // If we're running inside Chrome OS, bootstrap the sync authentication by
+ // using the LSID cookie provided by the Chrome OS login manager.
+ net::CookieMonster::CookieList cookies = profile()->GetRequestContext()->
+ GetCookieStore()->GetCookieMonster()->GetAllCookies();
+ for (net::CookieMonster::CookieList::const_iterator it = cookies.begin();
+ it != cookies.end(); ++it) {
+ if (kLsidCookieDomain == it->first) {
+ const net::CookieMonster::CanonicalCookie& cookie = it->second;
+ if (kLsidCookieName == cookie.Name()) {
+ return cookie.Value();
+ }
}
}
}
-#endif
return std::string();
}
@@ -429,11 +427,17 @@ void ProfileSyncService::StartProcessingChangesIfReady() {
if (!backend_initialized_)
return;
- // Show the sync merge warning dialog if needed.
- if (MergeAndSyncAcceptanceNeeded()) {
- ProfileSyncService::SyncEvent(MERGE_AND_SYNC_NEEDED);
- wizard_.Step(SyncSetupWizard::MERGE_AND_SYNC);
- return;
+ if (browser_defaults::kBootstrapSyncAuthentication) {
+ // If we're running inside Chrome OS, skip the merge warning and consider
+ // the sync setup complete.
+ SetSyncSetupCompleted();
+ } else {
+ // Show the sync merge warning dialog if needed.
+ if (MergeAndSyncAcceptanceNeeded()) {
+ ProfileSyncService::SyncEvent(MERGE_AND_SYNC_NEEDED);
+ wizard_.Step(SyncSetupWizard::MERGE_AND_SYNC);
+ return;
+ }
}
// We're ready to merge the models.