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

Unified Diff: components/autofill/core/browser/region_combobox_model.h

Issue 2803443003: [Payments] Added region load failure tolerance and tests to PR editor. (Closed)
Patch Set: Removed unneeded include. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/autofill/core/browser/region_combobox_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/region_combobox_model.h
diff --git a/components/autofill/core/browser/region_combobox_model.h b/components/autofill/core/browser/region_combobox_model.h
index 7d925711724a28698ab49855216d136a784b3464..aa16bc88e5df1209debaa596bd49d5143267f3ef 100644
--- a/components/autofill/core/browser/region_combobox_model.h
+++ b/components/autofill/core/browser/region_combobox_model.h
@@ -36,6 +36,9 @@ class RegionComboboxModel : public ui::ComboboxModel {
const std::string& country_code);
~RegionComboboxModel() override;
+ bool pending_region_data_load() const { return pending_region_data_load_; }
+ bool failed_to_load_data() const { return failed_to_load_data_; }
+
// ui::ComboboxModel implementation:
int GetItemCount() const override;
base::string16 GetItemAt(int index) override;
@@ -43,12 +46,22 @@ class RegionComboboxModel : public ui::ComboboxModel {
void AddObserver(ui::ComboboxModelObserver* observer) override;
void RemoveObserver(ui::ComboboxModelObserver* observer) override;
+ // To allow testing failure states.
+ void SetFailureModeForTests(bool failed_to_load_data);
+
+ private:
+ // Start the potentially asynchronous process of loading region data.
+ void LoadRegionData(const std::string& country_code);
+
// Callback for ::i18n::addressinput::PreloadSupplier::LoadRules
void RegionDataLoaded(bool success, const std::string&, int rule_count);
- private:
// Whether the region data load failed or not.
- bool failed_to_load_data_{false};
+ bool failed_to_load_data_;
+
+ // Set to true during region data load, and false otherwise. Whether the load
+ // succeeded or not doesn't affect this value.
+ bool pending_region_data_load_;
// The application locale.
const std::string app_locale_;
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/autofill/core/browser/region_combobox_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698