OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WATCHER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WATCHER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "chrome/browser/sync/backend_migrator.h" |
| 10 #include "sync/internal_api/public/base/model_type.h" |
| 11 |
| 12 class ProfileSyncServiceHarness; |
| 13 class MigrationWaiter; |
| 14 |
| 15 // Helper class to observe and record migration state. |
| 16 class MigrationWatcher : public browser_sync::MigrationObserver { |
| 17 public: |
| 18 explicit MigrationWatcher(ProfileSyncServiceHarness* harness); |
| 19 virtual ~MigrationWatcher(); |
| 20 |
| 21 // Returns true if the observed profile has a migration in progress. |
| 22 bool HasPendingBackendMigration() const; |
| 23 |
| 24 // Returns the set of types this class has observed being migrated. |
| 25 syncer::ModelTypeSet GetMigratedTypes() const; |
| 26 |
| 27 // Implementation of browser_sync::MigrationObserver. |
| 28 virtual void OnMigrationStateChange() OVERRIDE; |
| 29 |
| 30 // Registers the |waiter| to receive callbacks on migration state change. |
| 31 void set_migration_waiter(MigrationWaiter* waiter); |
| 32 |
| 33 // Unregisters the current MigrationWaiter, if any. |
| 34 void clear_migration_waiter(); |
| 35 |
| 36 private: |
| 37 // The ProfileSyncServiceHarness to watch. |
| 38 ProfileSyncServiceHarness* const harness_; |
| 39 |
| 40 // The set of data types currently undergoing migration. |
| 41 syncer::ModelTypeSet pending_types_; |
| 42 |
| 43 // The set of data types for which migration is complete. Accumulated by |
| 44 // successive calls to OnMigrationStateChanged. |
| 45 syncer::ModelTypeSet migrated_types_; |
| 46 |
| 47 // The MigrationWatier that is waiting for this migration to complete. |
| 48 MigrationWaiter* migration_waiter_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(MigrationWatcher); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WATCHER_H_ |
OLD | NEW |