| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual void AddObserver(SyncServiceObserver* observer) = 0; | 60 virtual void AddObserver(SyncServiceObserver* observer) = 0; |
| 61 virtual void RemoveObserver(SyncServiceObserver* observer) = 0; | 61 virtual void RemoveObserver(SyncServiceObserver* observer) = 0; |
| 62 | 62 |
| 63 // Returns true if |observer| has already been added as an observer. | 63 // Returns true if |observer| has already been added as an observer. |
| 64 virtual bool HasObserver(const SyncServiceObserver* observer) const = 0; | 64 virtual bool HasObserver(const SyncServiceObserver* observer) const = 0; |
| 65 | 65 |
| 66 // --------------------------------------------------------------------------- | 66 // --------------------------------------------------------------------------- |
| 67 // TODO(sync): The methods below were pulled from ProfileSyncService, and | 67 // TODO(sync): The methods below were pulled from ProfileSyncService, and |
| 68 // should be evaluated to see if they should stay. | 68 // should be evaluated to see if they should stay. |
| 69 | 69 |
| 70 // Returns true if sync is enabled/not suppressed and the user is logged in. | 70 // Returns true if sync is allowed, requested, and the user is logged in. |
| 71 // (being logged in does not mean that tokens are available - tokens may | 71 // (being logged in does not mean that tokens are available - tokens may |
| 72 // be missing because they have not loaded yet, or because they were deleted | 72 // be missing because they have not loaded yet, or because they were deleted |
| 73 // due to http://crbug.com/121755). | 73 // due to http://crbug.com/121755). |
| 74 // Virtual to enable mocking in tests. | 74 virtual bool CanSyncStart() const = 0; |
| 75 // TODO(tim): Remove this? Nothing in ProfileSyncService uses it, and outside | |
| 76 // callers use a seemingly arbitrary / redundant / bug prone combination of | |
| 77 // this method, IsSyncAllowed, and others. | |
| 78 virtual bool IsSyncEnabledAndLoggedIn() = 0; | |
| 79 | 75 |
| 80 // Disables sync for user. Use ShowLoginDialog to enable. | 76 // Disables sync for user. Use ShowLoginDialog to enable. |
| 81 virtual void DisableForUser() = 0; | 77 virtual void DisableForUser() = 0; |
| 82 | 78 |
| 83 // Stops sync at the user's request. | 79 // Stops sync at the user's request. |
| 84 virtual void RequestStop() = 0; | 80 virtual void RequestStop() = 0; |
| 85 | 81 |
| 86 // The user requests that sync start. This only actually starts sync if | 82 // The user requests that sync start. This only actually starts sync if |
| 87 // IsSyncAllowed is true and the user is signed in. Once sync starts, | 83 // IsSyncAllowed is true and the user is signed in. Once sync starts, |
| 88 // other things such as HasSyncSetupCompleted being false can still prevent | 84 // other things such as HasSyncSetupCompleted being false can still prevent |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 protected: | 165 protected: |
| 170 SyncService() {} | 166 SyncService() {} |
| 171 | 167 |
| 172 private: | 168 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(SyncService); | 169 DISALLOW_COPY_AND_ASSIGN(SyncService); |
| 174 }; | 170 }; |
| 175 | 171 |
| 176 } // namespace sync_driver | 172 } // namespace sync_driver |
| 177 | 173 |
| 178 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ | 174 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_ |
| OLD | NEW |