summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 17:59:48 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 17:59:48 +0000
commitb780ce945a519a9c4c77f19516a95f5e2254b8fc (patch)
tree00de0bb0266cfd67e8d7cc2a599fee466acf7e3e /chrome/browser/dom_ui
parentbb5d5a10554732081cf484c0e624327fe46d8780 (diff)
downloadchromium_src-b780ce945a519a9c4c77f19516a95f5e2254b8fc.zip
chromium_src-b780ce945a519a9c4c77f19516a95f5e2254b8fc.tar.gz
chromium_src-b780ce945a519a9c4c77f19516a95f5e2254b8fc.tar.bz2
Fix chromium-os:10777 and other sync related crashes.
Return NULL when GetProfileSyncService() is called without a cros_user argument (if not already initialized) and protect the settings code when sync service is NULL. A side effect of this is that sync will be disabled if chrome is not started from the login screen in ChromeOS (e.g. when debugging), instead of being initialized without a valid backend, so e.g. settings will not have a sync section, and about:sync will show 'sync disabled'. BUG=chromium-os:10777,chromium-os:10893 TEST=Test proxy settings from login screen, sync settings page, and about:sync. Review URL: http://codereview.chromium.org/6260002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/options/personal_options_handler.cc2
-rw-r--r--chrome/browser/dom_ui/options/sync_options_handler.cc7
2 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/dom_ui/options/personal_options_handler.cc b/chrome/browser/dom_ui/options/personal_options_handler.cc
index bc14c1f..7102a7a 100644
--- a/chrome/browser/dom_ui/options/personal_options_handler.cc
+++ b/chrome/browser/dom_ui/options/personal_options_handler.cc
@@ -154,6 +154,7 @@ void PersonalOptionsHandler::OnStateChanged() {
string16 status_label;
string16 link_label;
ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
+ DCHECK(service);
bool managed = service->IsManaged();
bool sync_setup_completed = service->HasSyncSetupCompleted();
bool status_has_error = sync_ui_util::GetStatusLabels(service,
@@ -275,6 +276,7 @@ void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) {
dom_ui_->tab_contents(), UTF8ToUTF16(email), message, this);
#else
ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
+ DCHECK(service);
service->ShowLoginDialog(NULL);
ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS);
#endif
diff --git a/chrome/browser/dom_ui/options/sync_options_handler.cc b/chrome/browser/dom_ui/options/sync_options_handler.cc
index e67050c..da9b080 100644
--- a/chrome/browser/dom_ui/options/sync_options_handler.cc
+++ b/chrome/browser/dom_ui/options/sync_options_handler.cc
@@ -59,10 +59,9 @@ void SyncOptionsHandler::GetLocalizedValues(
void SyncOptionsHandler::Initialize() {
ProfileSyncService* service =
- dom_ui_->GetProfile()->GetOriginalProfile()->GetProfileSyncService();
- // If service is unavailable for some good reason, 'IsEnabled()' method
- // should return false. Otherwise something is broken.
- DCHECK(service);
+ dom_ui_->GetProfile()->GetProfileSyncService();
+ if (!service)
+ return; // Can happen in ChromeOS if called before login.
DictionaryValue args;
SyncSetupFlow::GetArgsForConfigure(service, &args);