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

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: Fix typo in chromeos Created 6 years, 11 months 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
« no previous file with comments | « chrome/browser/signin/signin_tracker.h ('k') | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f7b502ee050b0b114357286510a3cfc4db5a55d9 100644
--- a/chrome/browser/signin/signin_tracker.cc
+++ b/chrome/browser/signin/signin_tracker.cc
@@ -6,14 +6,19 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/account_reconcilor_factory.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"
-#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/common/profile_management_switches.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "google_apis/gaia/gaia_constants.h"
+#if !defined(OS_CHROMEOS)
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#endif
+
SigninTracker::SigninTracker(Profile* profile, Observer* observer)
: profile_(profile), observer_(observer) {
DCHECK(profile_);
@@ -23,6 +28,18 @@ SigninTracker::SigninTracker(Profile* profile, Observer* observer)
SigninTracker::~SigninTracker() {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
RemoveObserver(this);
+
+ if (!switches::IsEnableWebBasedSignin()) {
+ if (switches::IsNewProfileManagement()) {
+ AccountReconcilorFactory::GetForProfile(profile_)->
+ RemoveMergeSessionObserver(this);
+#if !defined(OS_CHROMEOS)
+ } else {
+ SigninManagerFactory::GetForProfile(profile_)->
+ RemoveMergeSessionObserver(this);
+#endif
+ }
+ }
}
void SigninTracker::Initialize() {
@@ -52,9 +69,27 @@ void SigninTracker::Observe(int type,
void SigninTracker::OnRefreshTokenAvailable(const std::string& account_id) {
// TODO: when OAuth2TokenService handles multi-login, this should check
// that |account_id| is the primary account before signalling success.
+ if (!switches::IsEnableWebBasedSignin()) {
+ if (switches::IsNewProfileManagement()) {
+ AccountReconcilorFactory::GetForProfile(profile_)->
+ AddMergeSessionObserver(this);
+#if !defined(OS_CHROMEOS)
+ } else {
+ SigninManagerFactory::GetForProfile(profile_)->
+ AddMergeSessionObserver(this);
+#endif
+ }
+ }
+
observer_->SigninSuccess();
}
void SigninTracker::OnRefreshTokenRevoked(const std::string& account_id) {
NOTREACHED();
}
+
+void SigninTracker::MergeSessionCompleted(
+ const std::string& account_id,
+ const GoogleServiceAuthError& error) {
+ observer_->MergeSessionComplete(error);
+}
« no previous file with comments | « chrome/browser/signin/signin_tracker.h ('k') | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698