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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_context.h

Issue 2320813002: arc: Enable silent PlayStore Sign-In. (Closed)
Patch Set: cleanup Created 4 years, 3 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/arc/arc_auth_context.h
diff --git a/chrome/browser/chromeos/arc/arc_auth_context.h b/chrome/browser/chromeos/arc/arc_auth_context.h
index d1f111525f88a203030462f00fdfe7467c932847..c391a6f06ca7d27dcc392e778508c7f821f5fc78 100644
--- a/chrome/browser/chromeos/arc/arc_auth_context.h
+++ b/chrome/browser/chromeos/arc/arc_auth_context.h
@@ -10,7 +10,9 @@
#include "base/macros.h"
#include "base/timer/timer.h"
+#include "google_apis/gaia/oauth2_token_service.h"
#include "google_apis/gaia/ubertoken_fetcher.h"
+#include "net/url_request/url_fetcher.h"
class Profile;
class ProfileOAuth2TokenService;
@@ -25,12 +27,15 @@ class ArcAuthContextDelegate;
class ArcAuthContext : public UbertokenConsumer,
public GaiaAuthConsumer,
- public OAuth2TokenService::Observer {
+ public OAuth2TokenService::Observer,
+ public OAuth2TokenService::Consumer,
+ public net::URLFetcherDelegate {
xiyuan 2016/09/07 21:07:55 Can we create a separate class and make it a membe
khmel 2016/09/07 23:08:53 +1
public:
ArcAuthContext(ArcAuthContextDelegate* delegate, Profile* profile);
~ArcAuthContext() override;
void PrepareContext();
+ void FetchAuthCode(const std::string& auth_endpoint);
// OAuth2TokenService::Observer:
void OnRefreshTokenAvailable(const std::string& account_id) override;
@@ -44,17 +49,31 @@ class ArcAuthContext : public UbertokenConsumer,
void OnMergeSessionSuccess(const std::string& data) override;
void OnMergeSessionFailure(const GoogleServiceAuthError& error) override;
+ // OAuth2TokenService::Consumer:
+ void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
+ const std::string& access_token,
+ const base::Time& expiration_time) override;
+ void OnGetTokenFailure(const OAuth2TokenService::Request* request,
+ const GoogleServiceAuthError& error) override;
+
+ // net::URLFetcherDelegate:
+ void OnURLFetchComplete(const net::URLFetcher* source) override;
+
const std::string& account_id() const { return account_id_; }
ProfileOAuth2TokenService* token_service() { return token_service_; }
private:
void StartFetchers();
+ void ResetFetchers();
void OnRefreshTokenTimeout();
// Unowned pointers.
ArcAuthContextDelegate* const delegate_;
+ Profile* const profile_;
ProfileOAuth2TokenService* token_service_;
+ // URL to request auth code.
+ std::string auth_endpoint_;
bool context_prepared_ = false;
@@ -65,6 +84,8 @@ class ArcAuthContext : public UbertokenConsumer,
std::string account_id_;
std::unique_ptr<GaiaAuthFetcher> merger_fetcher_;
std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
+ std::unique_ptr<OAuth2TokenService::Request> login_token_request_;
+ std::unique_ptr<net::URLFetcher> auth_code_fetcher_;
base::OneShotTimer refresh_token_timeout_;
DISALLOW_COPY_AND_ASSIGN(ArcAuthContext);

Powered by Google App Engine
This is Rietveld 408576698