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

Unified Diff: chrome/browser/signin/dice_response_handler.h

Issue 2951263002: [Signin] Add timeout to Dice token exchange requests (Closed)
Patch Set: Rebase Created 3 years, 6 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 | « no previous file | chrome/browser/signin/dice_response_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/dice_response_handler.h
diff --git a/chrome/browser/signin/dice_response_handler.h b/chrome/browser/signin/dice_response_handler.h
index 8c4a1fdb29f49c1864ab39d1c911740402eab93e..17e7e620abe93aa07c10863d919a624c86d31290 100644
--- a/chrome/browser/signin/dice_response_handler.h
+++ b/chrome/browser/signin/dice_response_handler.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/cancelable_callback.h"
#include "base/macros.h"
#include "components/keyed_service/core/keyed_service.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
@@ -24,6 +25,9 @@ class SigninClient;
class ProfileOAuth2TokenService;
class Profile;
+// Exposed for testing.
+extern const int kDiceTokenFetchTimeoutSeconds;
+
// Processes the Dice responses from Gaia.
class DiceResponseHandler : public KeyedService {
public:
@@ -39,6 +43,9 @@ class DiceResponseHandler : public KeyedService {
// Must be called when receiving a Dice response header.
void ProcessDiceHeader(const signin::DiceResponseParams& dice_params);
+ // Returns the number of pending DiceTokenFetchers. Exposed for testing.
+ size_t GetPendingDiceTokenFetchersCountForTesting() const;
+
private:
// Helper class to fetch a refresh token from an authorization code.
class DiceTokenFetcher : public GaiaAuthConsumer {
@@ -57,6 +64,9 @@ class DiceResponseHandler : public KeyedService {
}
private:
+ // Called by |timeout_closure_| when the request times out.
+ void OnTimeout();
+
// GaiaAuthConsumer implementation:
void OnClientOAuthSuccess(
const GaiaAuthConsumer::ClientOAuthResult& result) override;
@@ -66,6 +76,7 @@ class DiceResponseHandler : public KeyedService {
std::string email_;
std::string authorization_code_;
DiceResponseHandler* dice_response_handler_;
+ base::CancelableClosure timeout_closure_;
std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
DISALLOW_COPY_AND_ASSIGN(DiceTokenFetcher);
« no previous file with comments | « no previous file | chrome/browser/signin/dice_response_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698