| 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; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class PrefService; | 21 class PrefService; |
| 21 | 22 |
| 22 // Class that allows configuring sync. It handles enabling and disabling it, as | 23 // Class that allows configuring sync. It handles enabling and disabling it, as |
| 23 // well as choosing datatypes. Most actions are delayed until a commit is done, | 24 // well as choosing datatypes. Most actions are delayed until a commit is done, |
| 24 // to allow the complex sync setup flow on iOS. | 25 // to allow the complex sync setup flow on iOS. |
| 25 class SyncSetupService : public KeyedService { | 26 class SyncSetupService : public KeyedService { |
| 26 public: | 27 public: |
| 27 typedef enum { | 28 typedef enum { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 private: | 99 private: |
| 99 // Enables or disables sync. Changes won't take effect in the sync backend | 100 // Enables or disables sync. Changes won't take effect in the sync backend |
| 100 // before the next call to |CommitChanges|. No changes are made to the | 101 // before the next call to |CommitChanges|. No changes are made to the |
| 101 // currently selected datatypes. | 102 // currently selected datatypes. |
| 102 void SetSyncEnabledWithoutChangingDatatypes(bool sync_enabled); | 103 void SetSyncEnabledWithoutChangingDatatypes(bool sync_enabled); |
| 103 | 104 |
| 104 sync_driver::SyncService* const sync_service_; | 105 sync_driver::SyncService* const sync_service_; |
| 105 PrefService* const prefs_; | 106 PrefService* const prefs_; |
| 106 syncer::ModelTypeSet user_selectable_types_; | 107 syncer::ModelTypeSet user_selectable_types_; |
| 107 | 108 |
| 109 // Handle preventing Sync from running until configuration is complete. |
| 110 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> setup_handle_; |
| 111 |
| 108 DISALLOW_COPY_AND_ASSIGN(SyncSetupService); | 112 DISALLOW_COPY_AND_ASSIGN(SyncSetupService); |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 #endif // IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ | 115 #endif // IOS_CHROME_BROWSER_SYNC_SYNC_SETUP_SERVICE_H_ |
| OLD | NEW |