Commit 8356ca73 authored by munjal@chromium.org's avatar munjal@chromium.org

Fix the sync sign in dialog issues for app notifications:

- Call PSS::ShowLoginDialog directly from app notification code so that the dialog comes up even if the user is logged in.
- Small fix to PSS to avoid infinite spinner in cases where the sync backend does not really change anything (ahd hence does not call back PSS).
Review URL: http://codereview.chromium.org/8783001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112840 0039d316-1c4b-4281-b951-d872f2087c98
parent 0d9a805b
......@@ -114,7 +114,9 @@ void AppNotifyChannelUIImpl::PromptSyncSetup(
void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) {
if (accepted) {
StartObservingSync();
browser_->ShowSyncSetup();
ProfileSyncService* service =
browser_->profile()->GetOriginalProfile()->GetProfileSyncService();
service->ShowLoginDialog();
} else {
delegate_->OnSyncSetupResult(false);
}
......
......@@ -1476,6 +1476,20 @@ void ProfileSyncService::Observe(int type,
AreCredentialsAvailable(true)) {
if (backend_initialized_) {
backend_->UpdateCredentials(GetCredentials());
const GoogleServiceAuthError& last_error = GetAuthError();
if (GoogleServiceAuthError::NONE == last_error.state()) {
// SyncBackendHost::UpdateCredentials call does not call back
// OnAuthError in cases when the underlying syncer state does not
// change. Due to that if the login dialog is showing up when the
// credentials have not expired as such (this happens when login
// dialog is shown by app notifications setup code) the login dialog
// will show the spinner forever. Hence, we call OnAuthError
// explicitly here to avoid the infinite spinner in that case.
// Note that SyncBackendHost::UpdateCredentials may actually end up
// failing, but in that case an error will be shown to the user in
// bookmarks bar and preferences.
OnAuthError();
}
}
if (!sync_prefs_.IsStartSuppressed())
StartUp();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment