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

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

Issue 2320813002: arc: Enable silent PlayStore Sign-In. (Closed)
Patch Set: nits 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
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/arc/arc_auth_code_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_auth_code_fetcher.h
diff --git a/chrome/browser/chromeos/arc/arc_auth_code_fetcher.h b/chrome/browser/chromeos/arc/arc_auth_code_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..c514602e32540424672c3683ad89c62d32e0827a
--- /dev/null
+++ b/chrome/browser/chromeos/arc/arc_auth_code_fetcher.h
@@ -0,0 +1,64 @@
+// Copyright 2016 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_ARC_ARC_AUTH_CODE_FETCHER_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CODE_FETCHER_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "google_apis/gaia/oauth2_token_service.h"
+#include "net/url_request/url_fetcher_delegate.h"
+
+class Profile;
+
+namespace net {
+class URLFetcher;
+class URLRequestContextGetter;
+}
+
+namespace arc {
+
+class ArcAuthCodeFetcherDelegate;
+
+class ArcAuthCodeFetcher : public OAuth2TokenService::Consumer,
+ public net::URLFetcherDelegate {
+ public:
+ ArcAuthCodeFetcher(ArcAuthCodeFetcherDelegate* delegate,
+ net::URLRequestContextGetter* request_context_getter,
+ Profile* profile,
+ const std::string& auth_endpoint);
+ ~ArcAuthCodeFetcher() 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;
+
+ private:
+ void ResetFetchers();
+
+ // Unowned pointers.
+ ArcAuthCodeFetcherDelegate* const delegate_;
+ net::URLRequestContextGetter* const request_context_getter_;
+ Profile* const profile_;
+
+ // URL to request auth code.
+ const std::string auth_endpoint_;
+
+ std::unique_ptr<OAuth2TokenService::Request> login_token_request_;
+ std::unique_ptr<net::URLFetcher> auth_code_fetcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcAuthCodeFetcher);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CODE_FETCHER_H_
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/arc/arc_auth_code_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698