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

Unified Diff: chrome/browser/signin/google_auto_login_helper.h

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
« no previous file with comments | « chrome/browser/signin/account_reconcilor.cc ('k') | chrome/browser/signin/google_auto_login_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/google_auto_login_helper.h
diff --git a/chrome/browser/signin/google_auto_login_helper.h b/chrome/browser/signin/google_auto_login_helper.h
index 914f49d25bd453006cf8872a7f73d031f9382f08..07d210cd427e274eae781517c53f9809599eeea5 100644
--- a/chrome/browser/signin/google_auto_login_helper.h
+++ b/chrome/browser/signin/google_auto_login_helper.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
-#define CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
+#ifndef CHROME_BROWSER_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
+#define CHROME_BROWSER_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
#include <deque>
@@ -13,37 +13,67 @@
class GaiaAuthFetcher;
class Profile;
-// Logs in the current signed in user into Google services. Populates the cookie
-// jar with Google credentials of the signed in user.
+// Merges a Google account known to Chrome into the cookie jar. Once the
+// account is merged, successfully or not, a NOTIFICATION_MERGE_SESSION_COMPLETE
+// notification is sent out. When mergin multiple accounts, once instance of
guohui 2013/12/18 22:27:10 nit: mergin->merging, once->one
Roger Tawa OOO till Jul 10th 2013/12/19 02:43:42 Done.
+// the helper is better than multiple instances if there is the possibility
+// that then run concurrently, since changes to the cookie must be serialized.
guohui 2013/12/18 22:27:10 nit: then->they
Roger Tawa OOO till Jul 10th 2013/12/19 02:43:42 Done.
+//
+// By default instances of GoogleAutoLoginHelper delete themselves when done.
class GoogleAutoLoginHelper : public GaiaAuthConsumer,
public UbertokenConsumer {
public:
+ struct MergeSessionDetails {
+ MergeSessionDetails(const std::string& account_id,
+ const GoogleServiceAuthError& error);
+
+ std::string account_id;
+ GoogleServiceAuthError error;
+ };
+
explicit GoogleAutoLoginHelper(Profile* profile);
virtual ~GoogleAutoLoginHelper();
void LogIn();
void LogIn(const std::string& account_id);
- // Overridden from GaiaAuthConsumer.
- virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE;
- virtual void OnMergeSessionFailure(const GoogleServiceAuthError& error)
- OVERRIDE;
+ // Tells this helper to not delete itself when its done with all accounts.
+ void disable_auto_delete_when_done() { auto_delete_when_done_ = false; }
+
+ protected:
+ Profile* profile() { return profile_; }
// Overridden from UbertokenConsumer.
virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE;
virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
- // For testing.
- virtual UbertokenFetcher* CreateNewUbertokenFetcher();
- virtual GaiaAuthFetcher* CreateNewGaiaAuthFetcher();
+ // Overridden from GaiaAuthConsumer.
+ virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE;
+ virtual void OnMergeSessionFailure(const GoogleServiceAuthError& error)
+ OVERRIDE;
private:
+ // Starts the proess of fetching the uber token and performing a merge session
+ // for the next account. Virtual so that it can be overriden in tests.
+ virtual void StartFetching();
+
+ // Send out notification when merge session completes.
+ // Virtual so that it can be overriden in tests.
+ virtual void SignalComplete(const GoogleServiceAuthError& error);
+
+ // Start the next merge session, if needed.
+ void MergeNextAccount();
+
+ // Delete |this| if the auto delete when done is enabled.
+ void AutoDeleteIfNeeded();
+
Profile* profile_;
scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
scoped_ptr<UbertokenFetcher> uber_token_fetcher_;
std::deque<std::string> accounts_;
+ bool auto_delete_when_done_;
DISALLOW_COPY_AND_ASSIGN(GoogleAutoLoginHelper);
};
-#endif // CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
+#endif // CHROME_BROWSER_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_
« no previous file with comments | « chrome/browser/signin/account_reconcilor.cc ('k') | chrome/browser/signin/google_auto_login_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698