Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.h

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + small fix Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
117 private: 128 private:
118 friend class StateChangeTimeoutEvent; 129 friend class StateChangeTimeoutEvent;
119 130
120 enum WaitState { 131 enum WaitState {
121 // The sync client has just been initialized. 132 // The sync client has just been initialized.
122 INITIAL_WAIT_STATE = 0, 133 INITIAL_WAIT_STATE = 0,
123 134
124 // The sync client awaits the OnBackendInitialized() callback. 135 // The sync client awaits the OnBackendInitialized() callback.
125 WAITING_FOR_ON_BACKEND_INITIALIZED, 136 WAITING_FOR_ON_BACKEND_INITIALIZED,
126 137
127 // Waiting for a passphrase to be required. 138 // Waiting for a passphrase to be required.
128 WAITING_FOR_PASSPHRASE_REQUIRED, 139 WAITING_FOR_PASSPHRASE_REQUIRED,
129 140
130 // Waiting for a set passphrase to be accepted by the cryptographer. 141 // Waiting for a set passphrase to be accepted by the cryptographer.
131 WAITING_FOR_PASSPHRASE_ACCEPTED, 142 WAITING_FOR_PASSPHRASE_ACCEPTED,
132 143
133 // The sync client is waiting for the first sync cycle to complete. 144 // The sync client is waiting for the first sync cycle to complete.
134 WAITING_FOR_INITIAL_SYNC, 145 WAITING_FOR_INITIAL_SYNC,
135 146
136 // The sync client is waiting for an ongoing sync cycle to complete. 147 // The sync client is waiting for an ongoing sync cycle to complete.
137 WAITING_FOR_SYNC_TO_FINISH, 148 WAITING_FOR_SYNC_TO_FINISH,
138 149
139 // The sync client anticipates incoming updates leading to a new sync cycle. 150 // The sync client anticipates incoming updates leading to a new sync cycle.
140 WAITING_FOR_UPDATES, 151 WAITING_FOR_UPDATES,
141 152
153 // The sync client anticipates encryption of new datatypes.
154 WAITING_FOR_ENCRYPTION,
155
142 // The sync client cannot reach the server. 156 // The sync client cannot reach the server.
143 SERVER_UNREACHABLE, 157 SERVER_UNREACHABLE,
144 158
145 // The sync client is fully synced and there are no pending updates. 159 // The sync client is fully synced and there are no pending updates.
146 FULLY_SYNCED, 160 FULLY_SYNCED,
147 161
148 // Syncing is disabled for the client. 162 // Syncing is disabled for the client.
149 SYNC_DISABLED, 163 SYNC_DISABLED,
150 164
151 NUMBER_OF_STATES, 165 NUMBER_OF_STATES,
(...skipping 20 matching lines...) Expand all
172 // other client has. 186 // other client has.
173 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); 187 bool MatchesOtherClient(ProfileSyncServiceHarness* partner);
174 188
175 // Logs message with relevant info about client's sync state (if available). 189 // Logs message with relevant info about client's sync state (if available).
176 void LogClientInfo(std::string message); 190 void LogClientInfo(std::string message);
177 191
178 // Gets the current progress indicator of the current sync session 192 // Gets the current progress indicator of the current sync session
179 // for a particular datatype. 193 // for a particular datatype.
180 std::string GetUpdatedTimestamp(syncable::ModelType model_type); 194 std::string GetUpdatedTimestamp(syncable::ModelType model_type);
181 195
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
182 WaitState wait_state_; 200 WaitState wait_state_;
183 201
184 Profile* profile_; 202 Profile* profile_;
185 ProfileSyncService* service_; 203 ProfileSyncService* service_;
186 204
187 // The harness of the client whose update progress marker we're expecting 205 // The harness of the client whose update progress marker we're expecting
188 // eventually match. 206 // eventually match.
189 ProfileSyncServiceHarness* timestamp_match_partner_; 207 ProfileSyncServiceHarness* timestamp_match_partner_;
190 208
191 // Credentials used for GAIA authentication. 209 // Credentials used for GAIA authentication.
192 std::string username_; 210 std::string username_;
193 std::string password_; 211 std::string password_;
194 212
195 // Client ID, used for logging purposes. 213 // Client ID, used for logging purposes.
196 int id_; 214 int id_;
197 215
198 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 216 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
199 }; 217 };
200 218
201 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 219 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/profile_sync_service_harness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698