blob: afec444e870d51ea701bec567b46b4a80df1c12e [file] [log] [blame]
[email protected]e053d822013-01-29 20:48:281// Copyright (c) 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 CHROME_BROWSER_AUTOFILL_WALLET_WALLET_CLIENT_OBSERVER_H_
6#define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_CLIENT_OBSERVER_H_
7
8#include <string>
9
10#include "base/memory/scoped_ptr.h"
11
12namespace wallet {
13
14class FullWallet;
15class WalletItems;
16
17// WalletClientObserver is to be implemented any classes making calls with
18// WalletClient. The appropriate callback method will be called on
19// WalletClientObserver with the response from the Online Wallet backend.
20class WalletClientObserver {
21 public:
22 // Called when an AcceptLegalDocuments request finishes successfully.
23 virtual void OnDidAcceptLegalDocuments() = 0;
24
25 // Called when an EncryptOtp request finishes successfully. |encrypted_otp|
26 // and |session_material| must be used when calling GetFullWallet.
27 virtual void OnDidEncryptOtp(const std::string& encrypted_otp,
28 const std::string& session_material) = 0;
29
30 // Called when an EscrowSensitiveInformation request finishes successfully.
31 // |escrow_handle| must be used when saving a new instrument using
32 // SaveInstrument or SaveAdressAndInstrument.
33 virtual void OnDidEscrowSensitiveInformation(
34 const std::string& escrow_handle) = 0;
35
36 // Called when a GetFullWallet request finishes successfully. Ownership is
37 // transferred to implementer of this interface.
38 virtual void OnDidGetFullWallet(scoped_ptr<FullWallet> full_wallet) = 0;
39
40 // Called when a GetWalletItems request finishes successfully. Ownership is
41 // transferred to implementer of this interface.
42 virtual void OnDidGetWalletItems(scoped_ptr<WalletItems> wallet_items) = 0;
43
44 // Called when a SaveAddress request finishes successfully. |address_id| can
45 // be used in subsequent GetFullWallet calls.
46 virtual void OnDidSaveAddress(const std::string& address_id) = 0;
47
48 // Called when a SaveInstrument request finishes sucessfully.
49 // |instrument_id| can be used in subsequent GetFullWallet calls.
50 virtual void OnDidSaveInstrument(const std::string& instrument_id) = 0;
51
52 // Called when a SaveInstrumentAndAddress request finishes succesfully.
53 // |instrument_id| and |address_id| can be used in subsequent
54 // GetFullWallet calls.
55 virtual void OnDidSaveInstrumentAndAddress(
56 const std::string& instrument_id,
57 const std::string& address_id) = 0;
58
59 // Called when a SendAutocheckoutStatus request finishes successfully.
60 virtual void OnDidSendAutocheckoutStatus() = 0;
61
[email protected]a2f7b972013-02-08 20:02:4662 // Called when an UpdateInstrument request finishes successfully.
63 virtual void OnDidUpdateInstrument(const std::string& instrument_id) = 0;
64
[email protected]e053d822013-01-29 20:48:2865 // TODO(ahutter): This is going to need more arguments, probably an error
66 // code and a message for the user.
67 // Called when a request fails due to an Online Wallet error.
68 virtual void OnWalletError() = 0;
69
70 // Called when a request fails due to a malformed response.
71 virtual void OnMalformedResponse() = 0;
72
73 // Called when a request fails due to a network error.
74 virtual void OnNetworkError(int response_code) = 0;
75
76 protected:
77 virtual ~WalletClientObserver() {}
78};
79
80} // namespace wallet
81
82#endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_CLIENT_OBSERVER_H_