Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/browser/autofill/wallet/encryption_escrow_client.h

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_BROWSER_AUTOFILL_WALLET_ENCRYPTION_ESCROW_CLIENT_H_
6 #define CHROME_BROWSER_AUTOFILL_WALLET_ENCRYPTION_ESCROW_CLIENT_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13
14 class GURL;
15
16 namespace net {
17 class URLFetcher;
18 class URLRequestContextGetter;
19 }
20
21 namespace autofill {
22 namespace wallet {
23
24 class EncryptionEscrowClientObserver;
25 class Instrument;
26
27 // EncrytionEscrowClient is responsible for making calls to the Online Wallet
28 // encryption and escrow backend.
29 class EncryptionEscrowClient : public net::URLFetcherDelegate {
30 public:
31 // |observer| must outlive |this|.
32 EncryptionEscrowClient(net::URLRequestContextGetter* context_getter,
33 EncryptionEscrowClientObserver* observer);
34 virtual ~EncryptionEscrowClient();
35
36 // Sends |one_time_pad|, a vector of cryptographically secure random bytes, to
37 // Online Wallet to be encrypted. These bytes must be generated using
38 // crypto/random.h.
39 void EncryptOneTimePad(const std::vector<uint8>& one_time_pad);
40
41 // Escrows the card verfication number of an existing instrument with Online
42 // Wallet. The escrow is keyed off of |obfuscated_gaia_id|.
43 void EscrowCardVerificationNumber(const std::string& card_verification_number,
44 const std::string& obfuscated_gaia_id);
45
46 // Escrows the primary account number and card verfication number of
47 // |new_instrument| with Online Wallet. The escrow is keyed off of
48 // |obfuscated_gaia_id|.
49 void EscrowInstrumentInformation(const Instrument& new_instrument,
50 const std::string& obfuscated_gaia_id);
51
52 private:
53 enum RequestType {
54 NO_PENDING_REQUEST,
55 ENCRYPT_ONE_TIME_PAD,
56 ESCROW_INSTRUMENT_INFORMATION,
57 ESCROW_CARD_VERIFICATION_NUMBER,
58 };
59
60 // Posts |post_body| to |url|. When the request is complete, |observer_| is
61 // notified of the result.
62 void MakeRequest(const GURL& url, const std::string& post_body);
63
64 // Performs bookkeeping tasks for any invalid requests.
65 void HandleMalformedResponse(net::URLFetcher* request);
66
67 // net::URLFetcherDelegate:
68 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
69
70 // The context for the request. Ensures the gdToken cookie is set as a header
71 // in the requests to Online Wallet if it is present.
72 scoped_refptr<net::URLRequestContextGetter> context_getter_;
73
74 // Observer class that has its various On* methods called based on the results
75 // of a request to Online Wallet.
76 EncryptionEscrowClientObserver* const observer_;
77
78 // The current request object.
79 scoped_ptr<net::URLFetcher> request_;
80
81 // The type of the current request. Must be NO_PENDING_REQUEST for a request
82 // to be initiated as only one request may be running at a given time.
83 RequestType request_type_;
84
85 DISALLOW_COPY_AND_ASSIGN(EncryptionEscrowClient);
86 };
87
88 } // namespace wallet
89 } // namespace autofill
90
91 #endif // CHROME_BROWSER_AUTOFILL_WALLET_ENCRYPTION_ESCROW_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/wallet/cart_unittest.cc ('k') | chrome/browser/autofill/wallet/encryption_escrow_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698