| 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 IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ | 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/autofill/core/browser/region_combobox_model.h" | 11 #include "components/autofill/core/browser/region_combobox_model.h" |
| 12 #include "ui/base/models/combobox_model_observer.h" | 12 #include "ui/base/models/combobox_model_observer.h" |
| 13 | 13 |
| 14 namespace autofill { | 14 namespace autofill { |
| 15 class RegionDataLoader; | 15 class RegionDataLoader; |
| 16 } // namespace autofill | 16 } // namespace autofill |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 class ComboboxModel; | 19 class ComboboxModel; |
| 20 } // namespace ui | 20 } // namespace ui |
| 21 | 21 |
| 22 @protocol RegionDataLoaderConsumer | 22 @protocol RegionDataLoaderConsumer |
| 23 | 23 |
| 24 - (void)regionDataLoaderDidSucceedWithRegions:(NSArray<NSString*>*)regions; | 24 // To be called with a map of region codes to region names when region data for |
| 25 // the given country code is loaded asynchronously. |
| 26 - (void)regionDataLoaderDidSucceedWithRegions: |
| 27 (NSDictionary<NSString*, NSString*>*)regions; |
| 25 | 28 |
| 26 @end | 29 @end |
| 27 | 30 |
| 28 class RegionDataLoader : public ui::ComboboxModelObserver { | 31 class RegionDataLoader : public ui::ComboboxModelObserver { |
| 29 public: | 32 public: |
| 30 explicit RegionDataLoader(id<RegionDataLoaderConsumer> consumer); | 33 explicit RegionDataLoader(id<RegionDataLoaderConsumer> consumer); |
| 31 ~RegionDataLoader() override; | 34 ~RegionDataLoader() override; |
| 32 | 35 |
| 33 void LoadRegionData(const std::string& country_code, | 36 void LoadRegionData(const std::string& country_code, |
| 34 autofill::RegionDataLoader* autofill_region_data_loader); | 37 autofill::RegionDataLoader* autofill_region_data_loader); |
| 35 | 38 |
| 36 // ui::ComboboxModelObserver | 39 // ui::ComboboxModelObserver |
| 37 void OnComboboxModelChanged(ui::ComboboxModel* model) override; | 40 void OnComboboxModelChanged(ui::ComboboxModel* model) override; |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 __weak id<RegionDataLoaderConsumer> consumer_; | 43 __weak id<RegionDataLoaderConsumer> consumer_; |
| 41 autofill::RegionComboboxModel region_model_; | 44 autofill::RegionComboboxModel region_model_; |
| 42 | 45 |
| 43 DISALLOW_COPY_AND_ASSIGN(RegionDataLoader); | 46 DISALLOW_COPY_AND_ASSIGN(RegionDataLoader); |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ | 49 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_REGION_DATA_LOADER_H_ |
| OLD | NEW |