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

Unified Diff: chrome/browser/chromeos/login/signin/oauth2_token_initializer.h

Issue 1097663003: Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set up default networks 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/signin/oauth2_token_initializer.h
diff --git a/chrome/browser/chromeos/login/signin/oauth2_token_initializer.h b/chrome/browser/chromeos/login/signin/oauth2_token_initializer.h
new file mode 100644
index 0000000000000000000000000000000000000000..b583ffd9ae859c8554ebfcfebe63acf87b0ec061
--- /dev/null
+++ b/chrome/browser/chromeos/login/signin/oauth2_token_initializer.h
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_INITIALIZER_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_INITIALIZER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h"
+#include "chromeos/login/auth/user_context.h"
+
+namespace chromeos {
+
+// Performs initial fetch of OAuth2 Tokens.
+class OAuth2TokenInitializer final : public OAuth2TokenFetcher::Delegate {
+ public:
+ // Callback to be invoked after initialization is done.
+ using FetchOAuth2TokensCallback =
+ base::Callback<void(bool success, const UserContext& user_context)>;
+
+ OAuth2TokenInitializer();
+ ~OAuth2TokenInitializer() override;
+
+ // Fetch OAuth2 tokens.
+ void Start(const UserContext& context,
+ const FetchOAuth2TokensCallback& callback);
+
+ private:
+ // OAuth2TokenFetcher::Delegate overrides.
+ void OnOAuth2TokensAvailable(
+ const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override;
+ void OnOAuth2TokensFetchFailed() override;
+
+ UserContext user_context_;
+ FetchOAuth2TokensCallback callback_;
+ scoped_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(OAuth2TokenInitializer);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_INITIALIZER_H_

Powered by Google App Engine
This is Rietveld 408576698