Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: chrome/browser/extensions/app_notify_channel_ui.cc

Issue 8783001: Fix the sync sign in dialog issues for app notifications: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/app_notify_channel_ui.h" 5 #include "chrome/browser/extensions/app_notify_channel_ui.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/infobars/infobar_tab_helper.h" 8 #include "chrome/browser/infobars/infobar_tab_helper.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 InfoBarTabHelper* helper = wrapper_->infobar_tab_helper(); 109 InfoBarTabHelper* helper = wrapper_->infobar_tab_helper();
110 helper->AddInfoBar(new AppNotifyChannelUIImpl::InfoBar( 110 helper->AddInfoBar(new AppNotifyChannelUIImpl::InfoBar(
111 this, helper, app_name_)); 111 this, helper, app_name_));
112 } 112 }
113 113
114 void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) { 114 void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) {
115 if (accepted) { 115 if (accepted) {
116 StartObservingSync(); 116 StartObservingSync();
117 browser_->ShowSyncSetup(); 117 ProfileSyncService* service =
118 browser_->profile()->GetOriginalProfile()->GetProfileSyncService();
119 service->ShowLoginDialog();
Andrew T Wilson (Slow) 2011/12/02 21:55:41 Do we need to worry about non-desktop platforms? S
Munjal (Google) 2011/12/03 01:25:33 On CrOS, the user will be logged in after Chrome u
118 } else { 120 } else {
119 delegate_->OnSyncSetupResult(false); 121 delegate_->OnSyncSetupResult(false);
120 } 122 }
121 } 123 }
122 124
123 void AppNotifyChannelUIImpl::OnStateChanged() { 125 void AppNotifyChannelUIImpl::OnStateChanged() {
124 ProfileSyncService* sync_service = 126 ProfileSyncService* sync_service =
125 browser_->profile()->GetProfileSyncService(); 127 browser_->profile()->GetProfileSyncService();
126 bool finished = got_first_sync_callback_ && !sync_service->SetupInProgress(); 128 bool finished = got_first_sync_callback_ && !sync_service->SetupInProgress();
127 got_first_sync_callback_ = true; 129 got_first_sync_callback_ = true;
128 130
129 if (finished) { 131 if (finished) {
130 StopObservingSync(); 132 StopObservingSync();
131 delegate_->OnSyncSetupResult(sync_service->HasSyncSetupCompleted()); 133 delegate_->OnSyncSetupResult(sync_service->HasSyncSetupCompleted());
132 } 134 }
133 } 135 }
134 136
135 void AppNotifyChannelUIImpl::StartObservingSync() { 137 void AppNotifyChannelUIImpl::StartObservingSync() {
136 CHECK(!observing_sync_); 138 CHECK(!observing_sync_);
137 observing_sync_ = true; 139 observing_sync_ = true;
138 browser_->profile()->GetProfileSyncService()->AddObserver(this); 140 browser_->profile()->GetProfileSyncService()->AddObserver(this);
139 } 141 }
140 142
141 void AppNotifyChannelUIImpl::StopObservingSync() { 143 void AppNotifyChannelUIImpl::StopObservingSync() {
142 CHECK(observing_sync_); 144 CHECK(observing_sync_);
143 observing_sync_ = false; 145 observing_sync_ = false;
144 browser_->profile()->GetProfileSyncService()->RemoveObserver(this); 146 browser_->profile()->GetProfileSyncService()->RemoveObserver(this);
145 } 147 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service.cc » ('j') | chrome/browser/sync/profile_sync_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698