| OLD | NEW |
| 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_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void LoadRegionData(const std::string& country_code, | 36 void LoadRegionData(const std::string& country_code, |
| 37 RegionDataLoader* region_data_loader, | 37 RegionDataLoader* region_data_loader, |
| 38 int64_t timeout_ms); | 38 int64_t timeout_ms); |
| 39 | 39 |
| 40 bool IsPendingRegionDataLoad() const { | 40 bool IsPendingRegionDataLoad() const { |
| 41 return region_data_loader_ != nullptr; | 41 return region_data_loader_ != nullptr; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool failed_to_load_data() const { return failed_to_load_data_; } | 44 bool failed_to_load_data() const { return failed_to_load_data_; } |
| 45 | 45 |
| 46 const std::vector<std::pair<std::string, std::string>>& GetRegions() const { |
| 47 return regions_; |
| 48 } |
| 49 |
| 46 // ui::ComboboxModel implementation: | 50 // ui::ComboboxModel implementation: |
| 47 int GetItemCount() const override; | 51 int GetItemCount() const override; |
| 48 base::string16 GetItemAt(int index) override; | 52 base::string16 GetItemAt(int index) override; |
| 49 bool IsItemSeparatorAt(int index) override; | 53 bool IsItemSeparatorAt(int index) override; |
| 50 void AddObserver(ui::ComboboxModelObserver* observer) override; | 54 void AddObserver(ui::ComboboxModelObserver* observer) override; |
| 51 void RemoveObserver(ui::ComboboxModelObserver* observer) override; | 55 void RemoveObserver(ui::ComboboxModelObserver* observer) override; |
| 52 | 56 |
| 53 private: | 57 private: |
| 54 // Callback for the RegionDataLoader. | 58 // Callback for the RegionDataLoader. |
| 55 void OnRegionDataLoaded( | 59 void OnRegionDataLoaded( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 | 71 |
| 68 // To be called when the data for the given country code was loaded. | 72 // To be called when the data for the given country code was loaded. |
| 69 base::ObserverList<ui::ComboboxModelObserver> observers_; | 73 base::ObserverList<ui::ComboboxModelObserver> observers_; |
| 70 | 74 |
| 71 DISALLOW_COPY_AND_ASSIGN(RegionComboboxModel); | 75 DISALLOW_COPY_AND_ASSIGN(RegionComboboxModel); |
| 72 }; | 76 }; |
| 73 | 77 |
| 74 } // namespace autofill | 78 } // namespace autofill |
| 75 | 79 |
| 76 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ | 80 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_REGION_COMBOBOX_MODEL_H_ |
| OLD | NEW |