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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.h

Issue 2828021: Take 2: sync changes to support encryption (Closed)
Patch Set: fix flaky password test under valgrind Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 bool invalidate_sync_xmpp_login, 109 bool invalidate_sync_xmpp_login,
110 NotificationMethod notification_method); 110 NotificationMethod notification_method);
111 111
112 // Called on |frontend_loop_| to kick off asynchronous authentication. 112 // Called on |frontend_loop_| to kick off asynchronous authentication.
113 void Authenticate(const std::string& username, const std::string& password, 113 void Authenticate(const std::string& username, const std::string& password,
114 const std::string& captcha); 114 const std::string& captcha);
115 115
116 // Called on |frontend_loop_| to start syncing. 116 // Called on |frontend_loop_| to start syncing.
117 void StartSyncing(); 117 void StartSyncing();
118 118
119 // Called on |frontend_loop_| to asynchronously set the passphrase.
120 void SetPassphrase(const std::string& passphrase);
121
119 // Called on |frontend_loop_| to kick off shutdown. 122 // Called on |frontend_loop_| to kick off shutdown.
120 // |sync_disabled| indicates if syncing is being disabled or not. 123 // |sync_disabled| indicates if syncing is being disabled or not.
121 // See the implementation and Core::DoShutdown for details. 124 // See the implementation and Core::DoShutdown for details.
122 void Shutdown(bool sync_disabled); 125 void Shutdown(bool sync_disabled);
123 126
124 // Changes the set of data types that are currently being synced. 127 // Changes the set of data types that are currently being synced.
125 // The ready_task will be run when all of the requested data types 128 // The ready_task will be run when all of the requested data types
126 // are up-to-date and ready for activation. The task will cancelled 129 // are up-to-date and ready for activation. The task will cancelled
127 // upon shutdown. The method takes ownership of the task pointer. 130 // upon shutdown. The method takes ownership of the task pointer.
128 virtual void ConfigureDataTypes(const syncable::ModelTypeSet& types, 131 virtual void ConfigureDataTypes(const syncable::ModelTypeSet& types,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 bool delete_sync_data_folder, 187 bool delete_sync_data_folder,
185 NotificationMethod notification_method) { 188 NotificationMethod notification_method) {
186 if (!core_thread_.Start()) 189 if (!core_thread_.Start())
187 return; 190 return;
188 registrar_.workers[GROUP_UI] = new UIModelWorker(frontend_loop_); 191 registrar_.workers[GROUP_UI] = new UIModelWorker(frontend_loop_);
189 registrar_.routing_info[syncable::BOOKMARKS] = GROUP_PASSIVE; 192 registrar_.routing_info[syncable::BOOKMARKS] = GROUP_PASSIVE;
190 registrar_.routing_info[syncable::PREFERENCES] = GROUP_PASSIVE; 193 registrar_.routing_info[syncable::PREFERENCES] = GROUP_PASSIVE;
191 registrar_.routing_info[syncable::AUTOFILL] = GROUP_PASSIVE; 194 registrar_.routing_info[syncable::AUTOFILL] = GROUP_PASSIVE;
192 registrar_.routing_info[syncable::THEMES] = GROUP_PASSIVE; 195 registrar_.routing_info[syncable::THEMES] = GROUP_PASSIVE;
193 registrar_.routing_info[syncable::TYPED_URLS] = GROUP_PASSIVE; 196 registrar_.routing_info[syncable::TYPED_URLS] = GROUP_PASSIVE;
197 registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
194 registrar_.routing_info[syncable::PASSWORDS] = GROUP_PASSIVE; 198 registrar_.routing_info[syncable::PASSWORDS] = GROUP_PASSIVE;
195 199
196 core_thread_.message_loop()->PostTask(FROM_HERE, 200 core_thread_.message_loop()->PostTask(FROM_HERE,
197 NewRunnableMethod(core_.get(), 201 NewRunnableMethod(core_.get(),
198 &SyncBackendHost::Core::DoInitializeForTest, 202 &SyncBackendHost::Core::DoInitializeForTest,
199 test_user, 203 test_user,
200 network_change_notifier_thread, 204 network_change_notifier_thread,
201 factory, 205 factory,
202 auth_factory, 206 auth_factory,
203 delete_sync_data_folder, 207 delete_sync_data_folder,
(...skipping 13 matching lines...) Expand all
217 // landing threads. 221 // landing threads.
218 virtual void OnChangesApplied( 222 virtual void OnChangesApplied(
219 syncable::ModelType model_type, 223 syncable::ModelType model_type,
220 const sync_api::BaseTransaction* trans, 224 const sync_api::BaseTransaction* trans,
221 const sync_api::SyncManager::ChangeRecord* changes, 225 const sync_api::SyncManager::ChangeRecord* changes,
222 int change_count); 226 int change_count);
223 virtual void OnSyncCycleCompleted( 227 virtual void OnSyncCycleCompleted(
224 const sessions::SyncSessionSnapshot* snapshot); 228 const sessions::SyncSessionSnapshot* snapshot);
225 virtual void OnInitializationComplete(); 229 virtual void OnInitializationComplete();
226 virtual void OnAuthError(const GoogleServiceAuthError& auth_error); 230 virtual void OnAuthError(const GoogleServiceAuthError& auth_error);
231 virtual void OnPassphraseRequired();
232 virtual void OnPassphraseAccepted();
227 virtual void OnPaused(); 233 virtual void OnPaused();
228 virtual void OnResumed(); 234 virtual void OnResumed();
229 235
230 struct DoInitializeOptions { 236 struct DoInitializeOptions {
231 DoInitializeOptions( 237 DoInitializeOptions(
232 const GURL& service_url, 238 const GURL& service_url,
233 bool attempt_last_user_authentication, 239 bool attempt_last_user_authentication,
234 chrome_common_net::NetworkChangeNotifierThread* 240 chrome_common_net::NetworkChangeNotifierThread*
235 network_change_notifier_thread, 241 network_change_notifier_thread,
236 sync_api::HttpPostProviderFactory* http_bridge_factory, 242 sync_api::HttpPostProviderFactory* http_bridge_factory,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Called on our SyncBackendHost's core_thread_ to perform authentication 283 // Called on our SyncBackendHost's core_thread_ to perform authentication
278 // on behalf of SyncBackendHost::Authenticate. 284 // on behalf of SyncBackendHost::Authenticate.
279 void DoAuthenticate(const std::string& username, 285 void DoAuthenticate(const std::string& username,
280 const std::string& password, 286 const std::string& password,
281 const std::string& captcha); 287 const std::string& captcha);
282 288
283 // Called on the SyncBackendHost core_thread_ to tell the syncapi to start 289 // Called on the SyncBackendHost core_thread_ to tell the syncapi to start
284 // syncing (generally after initialization and authentication). 290 // syncing (generally after initialization and authentication).
285 void DoStartSyncing(); 291 void DoStartSyncing();
286 292
293 // Called on our SyncBackendHost's |core_thread_| to set the passphrase
294 // on behalf of SyncBackendHost::SupplyPassphrase.
295 void DoSetPassphrase(const std::string& passphrase);
296
287 // The shutdown order is a bit complicated: 297 // The shutdown order is a bit complicated:
288 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final 298 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final
289 // SaveChanges, close sqlite handles, and halt the syncer thread (which 299 // SaveChanges, close sqlite handles, and halt the syncer thread (which
290 // could potentially block for 1 minute). 300 // could potentially block for 1 minute).
291 // 2) Then, from |frontend_loop_|, halt the core_thread_. This causes 301 // 2) Then, from |frontend_loop_|, halt the core_thread_. This causes
292 // syncapi thread-exit handlers to run and make use of cached pointers to 302 // syncapi thread-exit handlers to run and make use of cached pointers to
293 // various components owned implicitly by us. 303 // various components owned implicitly by us.
294 // 3) Destroy this Core. That will delete syncapi components in a safe order 304 // 3) Destroy this Core. That will delete syncapi components in a safe order
295 // because the thread that was using them has exited (in step 2). 305 // because the thread that was using them has exited (in step 2).
296 void DoShutdown(bool stopping_sync); 306 void DoShutdown(bool stopping_sync);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // SyncBackendHost |core_thread_|), using a repeating timer that is kicked 363 // SyncBackendHost |core_thread_|), using a repeating timer that is kicked
354 // off as soon as the SyncManager tells us it completed 364 // off as soon as the SyncManager tells us it completed
355 // initialization. 365 // initialization.
356 void SaveChanges(); 366 void SaveChanges();
357 367
358 // Dispatched to from HandleAuthErrorEventOnCoreLoop to handle updating 368 // Dispatched to from HandleAuthErrorEventOnCoreLoop to handle updating
359 // frontend UI components. 369 // frontend UI components.
360 void HandleAuthErrorEventOnFrontendLoop( 370 void HandleAuthErrorEventOnFrontendLoop(
361 const GoogleServiceAuthError& new_auth_error); 371 const GoogleServiceAuthError& new_auth_error);
362 372
373 // Invoked when a passphrase is required to decrypt a set of Nigori keys.
374 void NotifyPassphraseRequired();
375
376 // Invoked when the passphrase provided by the user has been accepted.
377 void NotifyPassphraseAccepted();
378
363 // Called from Core::OnSyncCycleCompleted to handle updating frontend 379 // Called from Core::OnSyncCycleCompleted to handle updating frontend
364 // thread components. 380 // thread components.
365 void HandleSyncCycleCompletedOnFrontendLoop( 381 void HandleSyncCycleCompletedOnFrontendLoop(
366 sessions::SyncSessionSnapshot* snapshot); 382 sessions::SyncSessionSnapshot* snapshot);
367 383
368 // Called from Core::OnInitializationComplete to handle updating 384 // Called from Core::OnInitializationComplete to handle updating
369 // frontend thread components. 385 // frontend thread components.
370 void HandleInitalizationCompletedOnFrontendLoop(); 386 void HandleInitalizationCompletedOnFrontendLoop();
371 387
372 // Return true if a model lives on the current thread. 388 // Return true if a model lives on the current thread.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 467
452 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. 468 // UI-thread cache of the last SyncSessionSnapshot received from syncapi.
453 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; 469 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_;
454 470
455 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 471 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
456 }; 472 };
457 473
458 } // namespace browser_sync 474 } // namespace browser_sync
459 475
460 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 476 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/password_model_associator.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698