Add diagnostics_writer.cc to the list of files allowed to printf.
[chromium-blink-merge.git] / components / autofill / content / browser / wallet / wallet_client_delegate.h
blob4a37899775dc747db0d889821f61cf3d4cf3f9ab
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.
5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_
8 #include <string>
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"
15 class AutofillMetrics;
17 namespace autofill {
18 namespace wallet {
20 class FullWallet;
21 class WalletItems;
23 // WalletClientDelegate is to be implemented any classes making calls with
24 // WalletClient. The appropriate callback method will be called on
25 // WalletClientDelegate with the response from the Online Wallet backend.
26 class WalletClientDelegate {
27 public:
28 // --------------------------------------
29 // Accessors called when making requests.
30 // --------------------------------------
32 // Returns the MetricLogger instance that should be used for logging Online
33 // Wallet metrics.
34 virtual const AutofillMetrics& GetMetricLogger() const = 0;
36 // Returns the serialized fingerprint data to be sent to the Risk server.
37 virtual std::string GetRiskData() const = 0;
39 // Returns the cookie value used for authorization when making requests to
40 // Wallet.
41 virtual std::string GetWalletCookieValue() const = 0;
43 // Whether or not shipping address is required by the delegate.
44 virtual bool IsShippingAddressRequired() const = 0;
46 // --------------------------------------------------------------------------
47 // Callbacks called with responses from the Online Wallet backend.
48 // --------------------------------------------------------------------------
50 // Called when an AcceptLegalDocuments request finishes successfully.
51 virtual void OnDidAcceptLegalDocuments() = 0;
53 // Called when an AuthenticateInstrument request finishes successfully.
54 virtual void OnDidAuthenticateInstrument(bool success) = 0;
56 // Called when a GetFullWallet request finishes successfully. Ownership is
57 // transferred to implementer of this interface.
58 virtual void OnDidGetFullWallet(scoped_ptr<FullWallet> full_wallet) = 0;
60 // Called when a GetWalletItems request finishes successfully. Ownership is
61 // transferred to implementer of this interface.
62 virtual void OnDidGetWalletItems(scoped_ptr<WalletItems> wallet_items) = 0;
64 // Called when a SaveToWallet request finishes succesfully.
65 // |instrument_id| and |address_id| can be used in subsequent
66 // GetFullWallet calls. |required_actions| is populated if there was a
67 // validation error with the data being saved. |form_field_errors| is
68 // populated with the actual form fields that are failing validation.
69 virtual void OnDidSaveToWallet(
70 const std::string& instrument_id,
71 const std::string& address_id,
72 const std::vector<RequiredAction>& required_actions,
73 const std::vector<FormFieldError>& form_field_errors) = 0;
75 // Called when a request fails.
76 virtual void OnWalletError(WalletClient::ErrorType error_type) = 0;
78 protected:
79 virtual ~WalletClientDelegate() {}
82 } // namespace wallet
83 } // namespace autofill
85 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_OBSERVER_H_