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

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

Issue 2942193002: [signin] Generate OAuth token on Dice Signin responses (Closed)
Patch Set: Review comments 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 | « chrome/browser/signin/chrome_signin_helper.cc ('k') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..10ae5b54e8129679a569d429902da5cb08a022a2
--- /dev/null
+++ b/chrome/browser/signin/dice_response_handler.h
@@ -0,0 +1,57 @@
+// Copyright 2017 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_SIGNIN_DICE_RESPONSE_HANDLER_H_
+#define CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_
+
+#include <memory>
+#include <string>
+
+#include "components/keyed_service/core/keyed_service.h"
+#include "google_apis/gaia/gaia_auth_consumer.h"
+
+namespace signin {
+struct DiceResponseParams;
+}
+
+class AccountTrackerService;
+class GaiaAuthFetcher;
+class SigninClient;
+class ProfileOAuth2TokenService;
+class Profile;
+
+// Processes the Dice responses from Gaia.
+class DiceResponseHandler : public GaiaAuthConsumer, public KeyedService {
+ public:
+ // Returns the DiceResponseHandler associated with this profile.
+ // May return nullptr if there is none (e.g. in incognito).
+ static DiceResponseHandler* GetForProfile(Profile* profile);
+
+ DiceResponseHandler(SigninClient* signin_client,
+ ProfileOAuth2TokenService* profile_oauth2_token_service,
+ AccountTrackerService* account_tracker_service);
+ ~DiceResponseHandler() override;
+
+ // Must be called when receiving a Dice response header.
+ void ProcessDiceHeader(const signin::DiceResponseParams& dice_params);
+
+ private:
+ // Process the Dice signin action.
+ void ProcessDiceSigninHeader(const std::string& gaia_id,
+ const std::string& email,
+ const std::string& authorization_code);
+
+ // GaiaAuthConsumer implementation:
+ void OnClientOAuthSuccess(const ClientOAuthResult& result) override;
+ void OnClientOAuthFailure(const GoogleServiceAuthError& error) override;
+
+ std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
+ std::string gaia_id_;
+ std::string email_;
+ SigninClient* signin_client_;
+ ProfileOAuth2TokenService* token_service_;
+ AccountTrackerService* account_tracker_service_;
+};
+
+#endif // CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_
« no previous file with comments | « chrome/browser/signin/chrome_signin_helper.cc ('k') | chrome/browser/signin/dice_response_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698