| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SYNC_SYNC_SETUP_SERVICE_H_ | 5 #ifndef IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ |
| 6 #define IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ | 6 #define IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 14 #include "sync/internal_api/public/util/syncer_error.h" | 14 #include "sync/internal_api/public/util/syncer_error.h" |
| 15 | 15 |
| 16 namespace sync_driver { | 16 namespace sync_driver { |
| 17 class SyncService; | 17 class SyncService; |
| 18 class SyncSetupInProgressHandle; | |
| 19 } | 18 } |
| 20 | 19 |
| 21 class PrefService; | 20 class PrefService; |
| 22 | 21 |
| 23 // Class that allows configuring sync. It handles enabling and disabling it, as | 22 // Class that allows configuring sync. It handles enabling and disabling it, as |
| 24 // well as choosing datatypes. Most actions are delayed until a commit is done, | 23 // well as choosing datatypes. Most actions are delayed until a commit is done, |
| 25 // to allow the complex sync setup flow on iOS. | 24 // to allow the complex sync setup flow on iOS. |
| 26 class SyncSetupService : public KeyedService { | 25 class SyncSetupService : public KeyedService { |
| 27 public: | 26 public: |
| 28 typedef enum { | 27 typedef enum { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 private: | 98 private: |
| 100 // Enables or disables sync. Changes won't take effect in the sync backend | 99 // Enables or disables sync. Changes won't take effect in the sync backend |
| 101 // before the next call to |CommitChanges|. No changes are made to the | 100 // before the next call to |CommitChanges|. No changes are made to the |
| 102 // currently selected datatypes. | 101 // currently selected datatypes. |
| 103 void SetSyncEnabledWithoutChangingDatatypes(bool sync_enabled); | 102 void SetSyncEnabledWithoutChangingDatatypes(bool sync_enabled); |
| 104 | 103 |
| 105 sync_driver::SyncService* const sync_service_; | 104 sync_driver::SyncService* const sync_service_; |
| 106 PrefService* const prefs_; | 105 PrefService* const prefs_; |
| 107 syncer::ModelTypeSet user_selectable_types_; | 106 syncer::ModelTypeSet user_selectable_types_; |
| 108 | 107 |
| 109 // Prevents Sync from running until configuration is complete. | |
| 110 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; | |
| 111 | |
| 112 DISALLOW_COPY_AND_ASSIGN(SyncSetupService); | 108 DISALLOW_COPY_AND_ASSIGN(SyncSetupService); |
| 113 }; | 109 }; |
| 114 | 110 |
| 115 #endif // IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ | 111 #endif // IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ |
| OLD | NEW |