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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 std::string username_; | 203 std::string username_; |
193 std::string password_; | 204 std::string password_; |
194 | 205 |
195 // Client ID, used for logging purposes. | 206 // Client ID, used for logging purposes. |
196 int id_; | 207 int id_; |
197 | 208 |
198 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 209 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
199 }; | 210 }; |
200 | 211 |
201 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 212 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
OLD | NEW |