summaryrefslogtreecommitdiffstats
path: root/components/autofill/browser/wallet/encryption_escrow_client_observer.h
blob: b0a0d0227f8ebfe06e4d1af76fb7201bbc71decd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_ENCRYPTION_ESCROW_CLIENT_OBSERVER_H_
#define COMPONENTS_AUTOFILL_BROWSER_WALLET_ENCRYPTION_ESCROW_CLIENT_OBSERVER_H_

#include <string>

namespace autofill {
namespace wallet {

// EncryptionEscrowClientObserver is to be implemented by any classes making
// calls with EncryptionEscrowClient. The appropriate callback method will be
// called on EncryptionEscrowClientObserver with the response from the Online
// Wallet encryption and escrow backend.
class EncryptionEscrowClientObserver {
 public:
  // Called when an EncryptOneTimePad request finishes successfully.
  // |encrypted_one_time_pad| and |session_material| must be used when getting a
  // FullWallet.
  virtual void OnDidEncryptOneTimePad(const std::string& encrypted_one_time_pad,
                                      const std::string& session_material) = 0;

  // Called when an EscrowCardVerificationNumber request finishes
  // successfully. |escrow_handle| must be used when authenticating an
  // instrument.
  virtual void OnDidEscrowCardVerificationNumber(
      const std::string& escrow_handle) = 0;

  // Called when an EscrowInstrumentInformation request finishes successfully.
  // |escrow_handle| must be used when saving a new instrument.
  virtual void OnDidEscrowInstrumentInformation(
      const std::string& escrow_handle) = 0;

  // Called when a request is made to the encryption escrow server.
  virtual void OnDidMakeRequest() = 0;

  // Called when a request fails due to a network error or if the response was
  // invalid.
  virtual void OnNetworkError(int response_code) = 0;

  // Called when a request fails due to a malformed response.
  virtual void OnMalformedResponse() = 0;

 protected:
  virtual ~EncryptionEscrowClientObserver() {}
};

}  // namespace wallet
}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_BROWSER_WALLET_ENCRYPTION_ESCROW_CLIENT_OBSERVER_H_