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

Unified Diff: chrome/browser/extensions/api/identity/gaia_web_auth_flow.h

Issue 2145103003: Request the Identity API's Uber Token without a Channel ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move IO thread bits in a separate class Created 4 years, 5 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/extensions/api/identity/gaia_web_auth_flow.h
diff --git a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
index 7cb132a5c4e36ffc28f823d811c55074f1a55c60..7cdbc03331553170c4491d2b325484d95c639392 100644
--- a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
+++ b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
@@ -10,6 +10,12 @@
#include "chrome/browser/extensions/api/identity/web_auth_flow.h"
#include "extensions/common/manifest_handlers/oauth2_manifest_handler.h"
#include "google_apis/gaia/ubertoken_fetcher.h"
+#include "net/http/http_cache.h"
+
+namespace net {
+class HttpNetworkSession;
+class TrivialURLRequestContextGetter;
+}
namespace extensions {
@@ -83,14 +89,44 @@ class GaiaWebAuthFlow : public UbertokenConsumer, public WebAuthFlow::Delegate {
// for testing. Used to kick off the MergeSession (step #2).
virtual std::unique_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url);
+ class IOHelper {
+ public:
+ IOHelper(base::WeakPtr<GaiaWebAuthFlow> gaia_web_auth_flow,
+ net::URLRequestContextGetter* main_context);
+ ~IOHelper();
+
+ void PrepareRequestContext();
+ void Cleanup();
+
+ net::URLRequestContext* ubertoken_request_context() {
+ return ubertoken_request_context_.get();
+ }
+
+ private:
+ std::unique_ptr<net::HttpCache::BackendFactory> app_backend_;
+ std::unique_ptr<net::HttpNetworkSession> http_network_session_;
+ std::unique_ptr<net::HttpCache> app_http_cache_;
+ std::unique_ptr<net::URLRequestContext> ubertoken_request_context_;
+
+ base::WeakPtr<GaiaWebAuthFlow> gaia_web_auth_flow_;
+ net::URLRequestContextGetter* main_context_;
+ };
+
+ void StartUberTokenFetch();
+
Delegate* delegate_;
Profile* profile_;
std::string account_id_;
std::string redirect_scheme_;
std::string redirect_path_prefix_;
GURL auth_url_;
+
+ std::unique_ptr<IOHelper> io_helper_;
std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
std::unique_ptr<WebAuthFlow> web_flow_;
+ scoped_refptr<net::TrivialURLRequestContextGetter> context_getter_;
+
+ base::WeakPtrFactory<GaiaWebAuthFlow> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(GaiaWebAuthFlow);
};

Powered by Google App Engine
This is Rietveld 408576698