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

Side by Side Diff: components/payments/core/subkey_requester.h

Issue 2966103002: [Payments] Show admin area complete names on PR form. (Closed)
Patch Set: Small Changes. Created 3 years, 5 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_ 5 #ifndef COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_
6 #define COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_ 6 #define COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" 9 #include "third_party/libaddressinput/chromium/chrome_address_validator.h"
10 10
11 namespace payments { 11 namespace payments {
12 12
13 // This receives a region code and the device's language.
13 using SubKeyReceiverCallback = 14 using SubKeyReceiverCallback =
14 base::OnceCallback<void(const std::vector<std::string>&)>; 15 base::OnceCallback<void(const std::vector<std::string>&,
16 const std::vector<std::string>&)>;
15 17
16 // SubKeyRequester Loads Rules from the server and extracts the subkeys. 18 // SubKeyRequester Loads Rules from the server and extracts the subkeys.
17 // For a given key (region code for a country, such as US), the list of its 19 // For a given key (region code for a country, such as US), the list of its
18 // corresponding subkeys is the list of that countries admin areas (states, 20 // corresponding subkeys is the list of that countries admin areas (states,
19 // provinces, ..). 21 // provinces, ..).
20 class SubKeyRequester : public autofill::LoadRulesListener { 22 class SubKeyRequester : public autofill::LoadRulesListener {
21 public: 23 public:
22 // The interface for the subkey request. 24 // The interface for the subkey request.
23 class Request { 25 class Request {
24 public: 26 public:
25 virtual void OnRulesLoaded() = 0; 27 virtual void OnRulesLoaded() = 0;
26 virtual ~Request() {} 28 virtual ~Request() {}
27 }; 29 };
28 30
29 SubKeyRequester(std::unique_ptr<i18n::addressinput::Source> source, 31 SubKeyRequester(std::unique_ptr<i18n::addressinput::Source> source,
30 std::unique_ptr<i18n::addressinput::Storage> storage); 32 std::unique_ptr<i18n::addressinput::Storage> storage);
31 ~SubKeyRequester() override; 33 ~SubKeyRequester() override;
32 34
33 // If the rules for |region_code| are loaded, this gets the subkeys for the 35 // If the rules for |region_code| are loaded, this gets the subkeys for the
34 // |region_code|, synchronously. If they are not loaded yet, it sets up a 36 // |region_code|, synchronously. If they are not loaded yet, it sets up a
35 // task to get the subkeys when the rules are loaded (asynchronous). If the 37 // task to get the subkeys when the rules are loaded (asynchronous). If the
36 // loading has not yet started, it will also start loading the rules for the 38 // loading has not yet started, it will also start loading the rules for the
37 // |region_code|. The received subkeys will be returned to the |requester|. If 39 // |region_code|. The received subkeys will be returned to the |requester|. If
38 // the subkeys are not received in |timeout_seconds|, then the requester will 40 // the subkeys are not received in |timeout_seconds|, then the requester will
39 // be informed and the request will be canceled. |requester| should never be 41 // be informed and the request will be canceled. |requester| should never be
40 // null. 42 // null. The requesting device language is set to |language|, ex:"fr".
41 void StartRegionSubKeysRequest(const std::string& region_code, 43 void StartRegionSubKeysRequest(const std::string& region_code,
44 const std::string& language,
42 int timeout_seconds, 45 int timeout_seconds,
43 SubKeyReceiverCallback cb); 46 SubKeyReceiverCallback cb);
44 47
45 // Returns whether the rules for the specified |region_code| have finished 48 // Returns whether the rules for the specified |region_code| have finished
46 // loading. 49 // loading.
47 bool AreRulesLoadedForRegion(const std::string& region_code); 50 bool AreRulesLoadedForRegion(const std::string& region_code);
48 51
49 // Start loading the rules for the specified |region_code|. 52 // Start loading the rules for the specified |region_code|.
50 virtual void LoadRulesForRegion(const std::string& region_code); 53 virtual void LoadRulesForRegion(const std::string& region_code);
51 54
(...skipping 12 matching lines...) Expand all
64 67
65 // The address validator used to load subkeys. 68 // The address validator used to load subkeys.
66 autofill::AddressValidator address_validator_; 69 autofill::AddressValidator address_validator_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(SubKeyRequester); 71 DISALLOW_COPY_AND_ASSIGN(SubKeyRequester);
69 }; 72 };
70 73
71 } // namespace payments 74 } // namespace payments
72 75
73 #endif // COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_ 76 #endif // COMPONENTS_PAYMENTS_CORE_SUBKEY_REQUESTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/android/personal_data_manager_android.cc ('k') | components/payments/core/subkey_requester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698