| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // Enables sync for all sync datatypes. | 108 // Enables sync for all sync datatypes. |
| 109 void EnableSyncForAllDatatypes(); | 109 void EnableSyncForAllDatatypes(); |
| 110 | 110 |
| 111 // Disables sync for all sync datatypes. | 111 // Disables sync for all sync datatypes. |
| 112 void DisableSyncForAllDatatypes(); | 112 void DisableSyncForAllDatatypes(); |
| 113 | 113 |
| 114 // Returns a snapshot of the current sync session. | 114 // Returns a snapshot of the current sync session. |
| 115 const SyncSessionSnapshot* GetLastSessionSnapshot() const; | 115 const SyncSessionSnapshot* GetLastSessionSnapshot() const; |
| 116 | 116 |
| 117 // Encrypt the datatype |type|. This method will block while the sync backend | |
| 118 // host performs the encryption or a timeout is reached. Returns false if | |
| 119 // encryption failed, else true. | |
| 120 // Note: this method does not currently support tracking encryption status | |
| 121 // while other sync activities are being performed. Sync should be fully | |
| 122 // synced when this is called. | |
| 123 bool EnableEncryptionForType(syncable::ModelType type); | |
| 124 | |
| 125 // Check if |type| is encrypted. | |
| 126 bool IsTypeEncrypted(syncable::ModelType type); | |
| 127 | |
| 128 private: | 117 private: |
| 129 friend class StateChangeTimeoutEvent; | 118 friend class StateChangeTimeoutEvent; |
| 130 | 119 |
| 131 enum WaitState { | 120 enum WaitState { |
| 132 // The sync client has just been initialized. | 121 // The sync client has just been initialized. |
| 133 INITIAL_WAIT_STATE = 0, | 122 INITIAL_WAIT_STATE = 0, |
| 134 | 123 |
| 135 // The sync client awaits the OnBackendInitialized() callback. | 124 // The sync client awaits the OnBackendInitialized() callback. |
| 136 WAITING_FOR_ON_BACKEND_INITIALIZED, | 125 WAITING_FOR_ON_BACKEND_INITIALIZED, |
| 137 | 126 |
| 138 // Waiting for a passphrase to be required. | 127 // Waiting for a passphrase to be required. |
| 139 WAITING_FOR_PASSPHRASE_REQUIRED, | 128 WAITING_FOR_PASSPHRASE_REQUIRED, |
| 140 | 129 |
| 141 // Waiting for a set passphrase to be accepted by the cryptographer. | 130 // Waiting for a set passphrase to be accepted by the cryptographer. |
| 142 WAITING_FOR_PASSPHRASE_ACCEPTED, | 131 WAITING_FOR_PASSPHRASE_ACCEPTED, |
| 143 | 132 |
| 144 // The sync client is waiting for the first sync cycle to complete. | 133 // The sync client is waiting for the first sync cycle to complete. |
| 145 WAITING_FOR_INITIAL_SYNC, | 134 WAITING_FOR_INITIAL_SYNC, |
| 146 | 135 |
| 147 // The sync client is waiting for an ongoing sync cycle to complete. | 136 // The sync client is waiting for an ongoing sync cycle to complete. |
| 148 WAITING_FOR_SYNC_TO_FINISH, | 137 WAITING_FOR_SYNC_TO_FINISH, |
| 149 | 138 |
| 150 // The sync client anticipates incoming updates leading to a new sync cycle. | 139 // The sync client anticipates incoming updates leading to a new sync cycle. |
| 151 WAITING_FOR_UPDATES, | 140 WAITING_FOR_UPDATES, |
| 152 | 141 |
| 153 // The sync client anticipates encryption of new datatypes. | |
| 154 WAITING_FOR_ENCRYPTION, | |
| 155 | |
| 156 // The sync client cannot reach the server. | 142 // The sync client cannot reach the server. |
| 157 SERVER_UNREACHABLE, | 143 SERVER_UNREACHABLE, |
| 158 | 144 |
| 159 // The sync client is fully synced and there are no pending updates. | 145 // The sync client is fully synced and there are no pending updates. |
| 160 FULLY_SYNCED, | 146 FULLY_SYNCED, |
| 161 | 147 |
| 162 // Syncing is disabled for the client. | 148 // Syncing is disabled for the client. |
| 163 SYNC_DISABLED, | 149 SYNC_DISABLED, |
| 164 | 150 |
| 165 NUMBER_OF_STATES, | 151 NUMBER_OF_STATES, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 186 // other client has. | 172 // other client has. |
| 187 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); | 173 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); |
| 188 | 174 |
| 189 // Logs message with relevant info about client's sync state (if available). | 175 // Logs message with relevant info about client's sync state (if available). |
| 190 void LogClientInfo(std::string message); | 176 void LogClientInfo(std::string message); |
| 191 | 177 |
| 192 // Gets the current progress indicator of the current sync session | 178 // Gets the current progress indicator of the current sync session |
| 193 // for a particular datatype. | 179 // for a particular datatype. |
| 194 std::string GetUpdatedTimestamp(syncable::ModelType model_type); | 180 std::string GetUpdatedTimestamp(syncable::ModelType model_type); |
| 195 | 181 |
| 196 // When in WAITING_FOR_ENCRYPTION state, we check to see if this type is now | |
| 197 // encrypted to determine if we're done. | |
| 198 syncable::ModelType waiting_for_encryption_type_; | |
| 199 | |
| 200 WaitState wait_state_; | 182 WaitState wait_state_; |
| 201 | 183 |
| 202 Profile* profile_; | 184 Profile* profile_; |
| 203 ProfileSyncService* service_; | 185 ProfileSyncService* service_; |
| 204 | 186 |
| 205 // The harness of the client whose update progress marker we're expecting | 187 // The harness of the client whose update progress marker we're expecting |
| 206 // eventually match. | 188 // eventually match. |
| 207 ProfileSyncServiceHarness* timestamp_match_partner_; | 189 ProfileSyncServiceHarness* timestamp_match_partner_; |
| 208 | 190 |
| 209 // Credentials used for GAIA authentication. | 191 // Credentials used for GAIA authentication. |
| 210 std::string username_; | 192 std::string username_; |
| 211 std::string password_; | 193 std::string password_; |
| 212 | 194 |
| 213 // Client ID, used for logging purposes. | 195 // Client ID, used for logging purposes. |
| 214 int id_; | 196 int id_; |
| 215 | 197 |
| 216 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 198 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 217 }; | 199 }; |
| 218 | 200 |
| 219 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 201 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |