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 bool EnableEncryptionForType(syncable::ModelType type); | |
121 | |
122 // Check if |type| is encrypted. | |
123 bool IsTypeEncrypted(syncable::ModelType type); | |
124 | |
117 private: | 125 private: |
118 friend class StateChangeTimeoutEvent; | 126 friend class StateChangeTimeoutEvent; |
119 | 127 |
120 enum WaitState { | 128 enum WaitState { |
121 // The sync client has just been initialized. | 129 // The sync client has just been initialized. |
122 INITIAL_WAIT_STATE = 0, | 130 INITIAL_WAIT_STATE = 0, |
123 | 131 |
124 // The sync client awaits the OnBackendInitialized() callback. | 132 // The sync client awaits the OnBackendInitialized() callback. |
125 WAITING_FOR_ON_BACKEND_INITIALIZED, | 133 WAITING_FOR_ON_BACKEND_INITIALIZED, |
126 | 134 |
127 // Waiting for a passphrase to be required. | 135 // Waiting for a passphrase to be required. |
128 WAITING_FOR_PASSPHRASE_REQUIRED, | 136 WAITING_FOR_PASSPHRASE_REQUIRED, |
129 | 137 |
130 // Waiting for a set passphrase to be accepted by the cryptographer. | 138 // Waiting for a set passphrase to be accepted by the cryptographer. |
131 WAITING_FOR_PASSPHRASE_ACCEPTED, | 139 WAITING_FOR_PASSPHRASE_ACCEPTED, |
132 | 140 |
133 // The sync client is waiting for the first sync cycle to complete. | 141 // The sync client is waiting for the first sync cycle to complete. |
134 WAITING_FOR_INITIAL_SYNC, | 142 WAITING_FOR_INITIAL_SYNC, |
135 | 143 |
136 // The sync client is waiting for an ongoing sync cycle to complete. | 144 // The sync client is waiting for an ongoing sync cycle to complete. |
137 WAITING_FOR_SYNC_TO_FINISH, | 145 WAITING_FOR_SYNC_TO_FINISH, |
138 | 146 |
139 // The sync client anticipates incoming updates leading to a new sync cycle. | 147 // The sync client anticipates incoming updates leading to a new sync cycle. |
140 WAITING_FOR_UPDATES, | 148 WAITING_FOR_UPDATES, |
141 | 149 |
150 // The sync client anticipates encryption of new datatypes. | |
151 WAITING_FOR_ENCRYPTION, | |
152 | |
142 // The sync client cannot reach the server. | 153 // The sync client cannot reach the server. |
143 SERVER_UNREACHABLE, | 154 SERVER_UNREACHABLE, |
144 | 155 |
145 // The sync client is fully synced and there are no pending updates. | 156 // The sync client is fully synced and there are no pending updates. |
146 FULLY_SYNCED, | 157 FULLY_SYNCED, |
147 | 158 |
148 // Syncing is disabled for the client. | 159 // Syncing is disabled for the client. |
149 SYNC_DISABLED, | 160 SYNC_DISABLED, |
150 | 161 |
151 NUMBER_OF_STATES, | 162 NUMBER_OF_STATES, |
(...skipping 20 matching lines...) Expand all Loading... | |
172 // other client has. | 183 // other client has. |
173 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); | 184 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); |
174 | 185 |
175 // Logs message with relevant info about client's sync state (if available). | 186 // Logs message with relevant info about client's sync state (if available). |
176 void LogClientInfo(std::string message); | 187 void LogClientInfo(std::string message); |
177 | 188 |
178 // Gets the current progress indicator of the current sync session | 189 // Gets the current progress indicator of the current sync session |
179 // for a particular datatype. | 190 // for a particular datatype. |
180 std::string GetUpdatedTimestamp(syncable::ModelType model_type); | 191 std::string GetUpdatedTimestamp(syncable::ModelType model_type); |
181 | 192 |
193 // When in WAITING_FOR_ENCRYPTION state, we check to see if this type is now | |
194 // encrypted to determine if we're done. | |
195 syncable::ModelType waiting_for_encryption_type_; | |
Raghu Simha
2011/02/14 22:56:51
It looks like you're always setting this member be
Nicolas Zea
2011/02/15 19:52:18
Done.
| |
196 | |
182 WaitState wait_state_; | 197 WaitState wait_state_; |
183 | 198 |
184 Profile* profile_; | 199 Profile* profile_; |
185 ProfileSyncService* service_; | 200 ProfileSyncService* service_; |
186 | 201 |
187 // The harness of the client whose update progress marker we're expecting | 202 // The harness of the client whose update progress marker we're expecting |
188 // eventually match. | 203 // eventually match. |
189 ProfileSyncServiceHarness* timestamp_match_partner_; | 204 ProfileSyncServiceHarness* timestamp_match_partner_; |
190 | 205 |
191 // Credentials used for GAIA authentication. | 206 // Credentials used for GAIA authentication. |
192 std::string username_; | 207 std::string username_; |
193 std::string password_; | 208 std::string password_; |
194 | 209 |
195 // Client ID, used for logging purposes. | 210 // Client ID, used for logging purposes. |
196 int id_; | 211 int id_; |
197 | 212 |
198 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 213 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
199 }; | 214 }; |
200 | 215 |
201 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 216 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
OLD | NEW |