| 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 GaiaAuthFetcher; |
| 19 class OAuth2TokenServiceDelegate; |
| 20 class SigninClient; |
| 21 class Profile; |
| 22 |
| 23 // Processes the Dice responses from Gaia. |
| 24 class DiceResponseHandler : public GaiaAuthConsumer, public KeyedService { |
| 25 public: |
| 26 // Returns the DiceResponseHandler associated with this profile. |
| 27 static DiceResponseHandler* GetForProfile(Profile* profile); |
| 28 |
| 29 DiceResponseHandler( |
| 30 SigninClient* signin_client, |
| 31 OAuth2TokenServiceDelegate* oauth2_token_service_delegate); |
| 32 |
| 33 // Must be called when receiving a Dice response header. |
| 34 void ProcessDiceHeader(const signin::DiceResponseParams& dice_params); |
| 35 |
| 36 private: |
| 37 ~DiceResponseHandler() override; |
| 38 |
| 39 // Process the Dice signin action. |
| 40 void ProcessDiceSigninHeader(const std::string& account_id, |
| 41 const std::string& authorization_code); |
| 42 |
| 43 // GaiaAuthConsumer implementation: |
| 44 void OnClientOAuthSuccess(const ClientOAuthResult& result) override; |
| 45 void OnClientOAuthFailure(const GoogleServiceAuthError& error) override; |
| 46 |
| 47 std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; |
| 48 std::string account_id_for_signin_; |
| 49 SigninClient* signin_client_; |
| 50 OAuth2TokenServiceDelegate* oauth2_token_service_delegate_; |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_SIGNIN_DICE_RESPONSE_HANDLER_H_ |
| OLD | NEW |