| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_ | |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "components/autofill/content/browser/wallet/form_field_error.h" | |
| 12 #include "components/autofill/content/browser/wallet/wallet_client.h" | |
| 13 #include "components/autofill/core/browser/autofill_client.h" | |
| 14 | |
| 15 namespace autofill { | |
| 16 namespace wallet { | |
| 17 | |
| 18 class FullWallet; | |
| 19 class WalletItems; | |
| 20 | |
| 21 // WalletClientDelegate is to be implemented any classes making calls with | |
| 22 // WalletClient. The appropriate callback method will be called on | |
| 23 // WalletClientDelegate with the response from the Online Wallet backend. | |
| 24 class WalletClientDelegate { | |
| 25 public: | |
| 26 // -------------------------------------- | |
| 27 // Accessors called when making requests. | |
| 28 // -------------------------------------- | |
| 29 | |
| 30 // Returns the serialized fingerprint data to be sent to the Risk server. | |
| 31 virtual std::string GetRiskData() const = 0; | |
| 32 | |
| 33 // Returns the cookie value used for authorization when making requests to | |
| 34 // Wallet. | |
| 35 virtual std::string GetWalletCookieValue() const = 0; | |
| 36 | |
| 37 // Whether or not shipping address is required by the delegate. | |
| 38 virtual bool IsShippingAddressRequired() const = 0; | |
| 39 | |
| 40 // -------------------------------------------------------------------------- | |
| 41 // Callbacks called with responses from the Online Wallet backend. | |
| 42 // -------------------------------------------------------------------------- | |
| 43 | |
| 44 // Called when an AcceptLegalDocuments request finishes successfully. | |
| 45 virtual void OnDidAcceptLegalDocuments() = 0; | |
| 46 | |
| 47 // Called when an AuthenticateInstrument request finishes successfully. | |
| 48 virtual void OnDidAuthenticateInstrument(bool success) = 0; | |
| 49 | |
| 50 // Called when a GetFullWallet request finishes successfully. Ownership is | |
| 51 // transferred to implementer of this interface. | |
| 52 virtual void OnDidGetFullWallet(scoped_ptr<FullWallet> full_wallet) = 0; | |
| 53 | |
| 54 // Called when a GetWalletItems request finishes successfully. Ownership is | |
| 55 // transferred to implementer of this interface. | |
| 56 virtual void OnDidGetWalletItems(scoped_ptr<WalletItems> wallet_items) = 0; | |
| 57 | |
| 58 // Called when a SaveToWallet request finishes succesfully. | |
| 59 // |instrument_id| and |address_id| can be used in subsequent | |
| 60 // GetFullWallet calls. |required_actions| is populated if there was a | |
| 61 // validation error with the data being saved. |form_field_errors| is | |
| 62 // populated with the actual form fields that are failing validation. | |
| 63 virtual void OnDidSaveToWallet( | |
| 64 const std::string& instrument_id, | |
| 65 const std::string& address_id, | |
| 66 const std::vector<RequiredAction>& required_actions, | |
| 67 const std::vector<FormFieldError>& form_field_errors) = 0; | |
| 68 | |
| 69 // Called when a request fails. | |
| 70 virtual void OnWalletError(WalletClient::ErrorType error_type) = 0; | |
| 71 | |
| 72 protected: | |
| 73 virtual ~WalletClientDelegate() {} | |
| 74 }; | |
| 75 | |
| 76 } // namespace wallet | |
| 77 } // namespace autofill | |
| 78 | |
| 79 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_ | |
| OLD | NEW |