OLD | NEW |
| (Empty) |
1 // 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 | |
12 namespace autofill { | |
13 namespace wallet { | |
14 | |
15 class FullWallet; | |
16 class WalletItems; | |
17 | |
18 // WalletClientObserver is to be implemented any classes making calls with | |
19 // WalletClient. The appropriate callback method will be called on | |
20 // WalletClientObserver with the response from the Online Wallet backend. | |
21 class WalletClientObserver { | |
22 public: | |
23 // Called when an AcceptLegalDocuments request finishes successfully. | |
24 virtual void OnDidAcceptLegalDocuments() = 0; | |
25 | |
26 // Called when an AuthenticateInstrument request finishes successfully. | |
27 virtual void OnDidAuthenticateInstrument(bool success) = 0; | |
28 | |
29 // Called when a GetFullWallet request finishes successfully. Ownership is | |
30 // transferred to implementer of this interface. | |
31 virtual void OnDidGetFullWallet(scoped_ptr<FullWallet> full_wallet) = 0; | |
32 | |
33 // Called when a GetWalletItems request finishes successfully. Ownership is | |
34 // transferred to implementer of this interface. | |
35 virtual void OnDidGetWalletItems(scoped_ptr<WalletItems> wallet_items) = 0; | |
36 | |
37 // Called when a SaveAddress request finishes successfully. |address_id| can | |
38 // be used in subsequent GetFullWallet calls. |required_actions| is populated | |
39 // if there was a validation error with the data being saved. | |
40 virtual void OnDidSaveAddress( | |
41 const std::string& address_id, | |
42 const std::vector<RequiredAction>& required_actions) = 0; | |
43 | |
44 // Called when a SaveInstrument request finishes sucessfully. |instrument_id| | |
45 // can be used in subsequent GetFullWallet calls. |required_actions| is | |
46 // populated if there was a validation error with the data being saved. | |
47 virtual void OnDidSaveInstrument( | |
48 const std::string& instrument_id, | |
49 const std::vector<RequiredAction>& required_actions) = 0; | |
50 | |
51 // Called when a SaveInstrumentAndAddress request finishes succesfully. | |
52 // |instrument_id| and |address_id| can be used in subsequent | |
53 // GetFullWallet calls. |required_actions| is populated if there was a | |
54 // validation error with the data being saved. | |
55 virtual void OnDidSaveInstrumentAndAddress( | |
56 const std::string& instrument_id, | |
57 const std::string& address_id, | |
58 const std::vector<RequiredAction>& required_actions) = 0; | |
59 | |
60 // Called when a SendAutocheckoutStatus request finishes successfully. | |
61 virtual void OnDidSendAutocheckoutStatus() = 0; | |
62 | |
63 // Called when an UpdateInstrument request finishes successfully. | |
64 // |required_actions| is populated if there was a validation error with the | |
65 // data being saved. | |
66 virtual void OnDidUpdateInstrument( | |
67 const std::string& instrument_id, | |
68 const std::vector<RequiredAction>& required_actions) = 0; | |
69 | |
70 // TODO(ahutter): This is going to need more arguments, probably an error | |
71 // code and a message for the user. | |
72 // Called when a request fails due to an Online Wallet error. | |
73 virtual void OnWalletError() = 0; | |
74 | |
75 // Called when a request fails due to a malformed response. | |
76 virtual void OnMalformedResponse() = 0; | |
77 | |
78 // Called when a request fails due to a network error. | |
79 virtual void OnNetworkError(int response_code) = 0; | |
80 | |
81 protected: | |
82 virtual ~WalletClientObserver() {} | |
83 }; | |
84 | |
85 } // namespace wallet | |
86 } // namespace autofill | |
87 | |
88 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_CLIENT_OBSERVER_H_ | |
OLD | NEW |