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

Unified Diff: chrome/browser/signin/signin_tracker.cc

Issue 110373007: Delay loading the NTP after sign in until MergeSession has been performed in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/signin_tracker.cc
diff --git a/chrome/browser/signin/signin_tracker.cc b/chrome/browser/signin/signin_tracker.cc
index 65c8154aa1229d2bbcbb913c8a6fb406ceb2e3f3..88e7cf53304bf93962688ec803010924434b1739 100644
--- a/chrome/browser/signin/signin_tracker.cc
+++ b/chrome/browser/signin/signin_tracker.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/google_auto_login_helper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
@@ -28,10 +29,13 @@ SigninTracker::~SigninTracker() {
void SigninTracker::Initialize() {
DCHECK(observer_);
- // Register for notifications from the SigninManager.
+ // Register for notifications from the SigninManager and sign in helper.
registrar_.Add(this,
chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED,
content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_MERGE_SESSION_COMPLETE,
+ content::Source<Profile>(profile_));
OAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
@@ -41,12 +45,25 @@ void SigninTracker::Initialize() {
void SigninTracker::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, type);
-
- // We should not get more than one of these notifications.
- const GoogleServiceAuthError& error =
- *(content::Details<const GoogleServiceAuthError>(details).ptr());
- observer_->SigninFailed(error);
+ switch (type) {
+ case chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED: {
+ // We should not get more than one of these notifications.
+ const GoogleServiceAuthError& error =
+ *(content::Details<const GoogleServiceAuthError>(details).ptr());
+ observer_->SigninFailed(error);
+ break;
+ }
+ case chrome::NOTIFICATION_MERGE_SESSION_COMPLETE: {
+ const GoogleAutoLoginHelper::MergeSessionDetails* merge_details =
+ content::Details<const GoogleAutoLoginHelper::MergeSessionDetails>(
+ details).ptr();
+ observer_->MergeSessionComplete(merge_details->error);
+ break;
+ }
+ default:
+ NOTREACHED() << "Type: " << type;
+ break;
+ }
}
void SigninTracker::OnRefreshTokenAvailable(const std::string& account_id) {

Powered by Google App Engine
This is Rietveld 408576698