Index: chrome/browser/profiles/profile.cc |
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc |
index 9c3b711324c2c066dee4909998b4984c3ea08b02..6206bd7eaf67df36361da0b2b4b1af92f58d7a0b 100644 |
--- a/chrome/browser/profiles/profile.cc |
+++ b/chrome/browser/profiles/profile.cc |
@@ -10,6 +10,7 @@ |
#include "build/build_config.h" |
#include "chrome/browser/first_run/first_run.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/sync/sync_prefs.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/pref_names.h" |
@@ -171,6 +172,11 @@ bool Profile::IsNewProfile() { |
} |
bool Profile::IsSyncAccessible() { |
+ if (ProfileSyncServiceFactory::HasProfileSyncService(this)) |
+ return !ProfileSyncServiceFactory::GetForProfile(this)->IsManaged(); |
+ |
+ // No ProfileSyncService created yet - we don't want to create one, so just |
+ // infer the accessible state by looking at prefs/command line flags. |
browser_sync::SyncPrefs prefs(GetPrefs()); |
return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged(); |
} |