Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 IOS_CHROME_BROWSER_UI_SETTINGS_PERSONAL_DATA_MANAGER_DATA_CHANGED_OBSERV ER_H_ | |
| 6 #define IOS_CHROME_BROWSER_UI_SETTINGS_PERSONAL_DATA_MANAGER_DATA_CHANGED_OBSERV ER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/run_loop.h" | |
| 10 #include "components/autofill/core/browser/personal_data_manager_observer.h" | |
| 11 | |
| 12 namespace autofill { | |
| 13 class PersonalDataManager; | |
| 14 } | |
| 15 | |
| 16 // Helper class to allow waiting until the asynchronous operation on the | |
| 17 // autofill::PersonalDataManager completed. Need to be used like this: | |
| 18 // | |
| 19 // autofill::PersonalDataManager* personal_data_manager = ...; | |
| 20 // PersonalDataManagerDataChangedObserver observer(personal_data_manager); | |
| 21 // personal_data_manager->...(); // Starts some asynchronous operation. | |
| 22 // observer.Wait(); | |
| 23 // | |
| 24 class PersonalDataManagerDataChangedObserver | |
| 25 : public autofill::PersonalDataManagerObserver { | |
| 26 public: | |
| 27 PersonalDataManagerDataChangedObserver( | |
| 28 autofill::PersonalDataManager* personal_data_manager); | |
| 29 ~PersonalDataManagerDataChangedObserver() override; | |
| 30 | |
| 31 void Wait(); | |
|
noyau (Ping after 24h)
2016/12/22 13:17:22
Need comment.
sdefresne
2016/12/22 13:28:12
Done.
| |
| 32 | |
| 33 // autofill::PersonalDataManagerObserver implementation. | |
| 34 void OnPersonalDataChanged() override; | |
| 35 | |
| 36 private: | |
| 37 autofill::PersonalDataManager* personal_data_manager_; | |
| 38 base::RunLoop run_loop_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerDataChangedObserver); | |
| 41 }; | |
| 42 | |
| 43 #endif // IOS_CHROME_BROWSER_UI_SETTINGS_PERSONAL_DATA_MANAGER_DATA_CHANGED_OBS ERVER_H_ | |
| OLD | NEW |