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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.h

Issue 1097663003: Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove logging Created 5 years, 8 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
Index: chrome/browser/chromeos/login/session/user_session_manager.h
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h
index 9be9b718e3548d87a8e858381cb2998ee901df49..f8767749be8a1e37293c89b12883f3601f4ebc79 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.h
+++ b/chrome/browser/chromeos/login/session/user_session_manager.h
@@ -15,8 +15,10 @@
#include "base/observer_list.h"
#include "chrome/browser/chromeos/base/locale_util.h"
#include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
+#include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h"
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/login/auth/authenticator.h"
+#include "chromeos/login/auth/login_performer.h"
#include "chromeos/login/auth/user_context.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
@@ -79,7 +81,8 @@ class UserSessionManager
public net::NetworkChangeNotifier::ConnectionTypeObserver,
public base::SupportsWeakPtr<UserSessionManager>,
public UserSessionManagerDelegate,
- public user_manager::UserManager::UserSessionStateObserver {
+ public user_manager::UserManager::UserSessionStateObserver,
+ public OAuth2TokenFetcher::Delegate {
public:
// Context of StartSession calls.
typedef enum {
@@ -96,6 +99,10 @@ class UserSessionManager
SECONDARY_USER_SESSION_AFTER_CRASH,
} StartSessionType;
+ using FetchOAuth2TokensCallback =
+ base::Callback<void(const UserContext& user_context,
+ LoginPerformer::AuthorizationMode auth_mode)>;
+
// Returns UserSessionManager instance.
static UserSessionManager* GetInstance();
@@ -117,6 +124,9 @@ class UserSessionManager
scoped_refptr<Authenticator> CreateAuthenticator(
AuthStatusConsumer* consumer);
+ void FetchOAuth2Tokens(const UserContext& user_context,
+ const FetchOAuth2TokensCallback& callback);
+
// Start user session given |user_context|.
// OnProfilePrepared() will be called on |delegate| once Profile is ready.
void StartSession(const UserContext& user_context,
@@ -254,6 +264,11 @@ class UserSessionManager
// Used when restoring user sessions after crash.
void OnProfilePrepared(Profile* profile, bool browser_launched) override;
+ // OAuth2TokenFetcher::Delegate overrides.
+ void OnOAuth2TokensAvailable(
+ const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override;
+ void OnOAuth2TokensFetchFailed() override;
+
void ChildAccountStatusReceivedCallback();
void StopChildStatusObserving();
@@ -434,6 +449,10 @@ class UserSessionManager
std::string chrome_client_id_;
std::string chrome_client_secret_;
+ std::string oauthlogin_access_token_;
xiyuan 2015/04/20 22:02:41 nit: Consider add this to UserContext.
achuithb 2015/04/21 07:10:21 Done.
+ std::string refresh_token_;
xiyuan 2015/04/20 22:02:41 nit: Use refresh_token field in user_context_.
achuithb 2015/04/21 07:10:21 Done.
+ FetchOAuth2TokensCallback login_callback_;
+
// Per-user-session Input Methods states.
std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>,
ProfileCompare> default_ime_states_;
@@ -449,6 +468,8 @@ class UserSessionManager
// Child account status is necessary for InitializeStartUrls call.
bool waiting_for_child_account_status_;
+ scoped_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_;
+
base::WeakPtrFactory<UserSessionManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(UserSessionManager);

Powered by Google App Engine
This is Rietveld 408576698