OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 13 |
| 14 namespace signin { |
| 15 struct DiceResponseParams; |
| 16 } |
| 17 |
| 18 class AccountTrackerService; |
| 19 class GaiaAuthFetcher; |
| 20 class SigninClient; |
| 21 class ProfileOAuth2TokenService; |
| 22 class Profile; |
| 23 |
| 24 // Processes the Dice responses from Gaia. |
| 25 class DiceResponseHandler : public GaiaAuthConsumer, public KeyedService { |
| 26 public: |
| 27 // Returns the DiceResponseHandler associated with this profile. |
| 28 // May return nullptr if there is none (e.g. in incognito). |
| 29 static DiceResponseHandler* GetForProfile(Profile* profile); |
| 30 |
| 31 DiceResponseHandler(SigninClient* signin_client, |
| 32 ProfileOAuth2TokenService* profile_oauth2_token_service, |
| 33 AccountTrackerService* account_tracker_service); |
| 34 ~DiceResponseHandler() override; |
| 35 |
| 36 // Must be called when receiving a Dice response header. |
| 37 void ProcessDiceHeader(const signin::DiceResponseParams& dice_params); |
| 38 |
| 39 private: |
| 40 // Process the Dice signin action. |
| 41 void ProcessDiceSigninHeader(const std::string& gaia_id, |
| 42 const std::string& email, |
| 43 const std::string& authorization_code); |
| 44 |
| 45 // GaiaAuthConsumer implementation: |
| 46 void OnClientOAuthSuccess(const ClientOAuthResult& result) override; |
| 47 void OnClientOAuthFailure(const GoogleServiceAuthError& error) override; |
| 48 |
| 49 std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; |
| 50 std::string gaia_id_; |
| 51 std::string email_; |
| 52 SigninClient* signin_client_; |
| 53 ProfileOAuth2TokenService* token_service_; |
| 54 AccountTrackerService* account_tracker_service_; |
| 55 }; |
| 56 |
| 57 #endif // CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_ |
OLD | NEW |