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

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

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 25 matching lines...) Expand all
36 class Profile; 36 class Profile;
37 37
38 namespace syncer { 38 namespace syncer {
39 class SyncManagerFactory; 39 class SyncManagerFactory;
40 } 40 }
41 41
42 namespace browser_sync { 42 namespace browser_sync {
43 43
44 class ChangeProcessor; 44 class ChangeProcessor;
45 class ChromeSyncNotificationBridge; 45 class ChromeSyncNotificationBridge;
46 struct Experiments;
47 class InvalidatorStorage; 46 class InvalidatorStorage;
48 class SyncBackendRegistrar; 47 class SyncBackendRegistrar;
49 class SyncPrefs; 48 class SyncPrefs;
49 class SyncedDeviceTracker;
50 struct Experiments;
50 51
51 // SyncFrontend is the interface used by SyncBackendHost to communicate with 52 // SyncFrontend is the interface used by SyncBackendHost to communicate with
52 // the entity that created it and, presumably, is interested in sync-related 53 // the entity that created it and, presumably, is interested in sync-related
53 // activity. 54 // activity.
54 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread 55 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread
55 // used to create that SyncBackendHost. 56 // used to create that SyncBackendHost.
56 class SyncFrontend : public syncer::InvalidationHandler { 57 class SyncFrontend : public syncer::InvalidationHandler {
57 public: 58 public:
58 SyncFrontend() {} 59 SyncFrontend() {}
59 60
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // Whether or not the Nigori node is encrypted using an explicit passphrase. 271 // Whether or not the Nigori node is encrypted using an explicit passphrase.
271 bool IsUsingExplicitPassphrase(); 272 bool IsUsingExplicitPassphrase();
272 273
273 // True if the cryptographer has any keys available to attempt decryption. 274 // True if the cryptographer has any keys available to attempt decryption.
274 // Could mean we've downloaded and loaded Nigori objects, or we bootstrapped 275 // Could mean we've downloaded and loaded Nigori objects, or we bootstrapped
275 // using a token previously received. 276 // using a token previously received.
276 bool IsCryptographerReady(const syncer::BaseTransaction* trans) const; 277 bool IsCryptographerReady(const syncer::BaseTransaction* trans) const;
277 278
278 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const; 279 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const;
279 280
281 // Fetches the DeviceInfo ChangeProcessor.
282 // We'll keep this test-only until we have non-test clients.
283 virtual SyncedDeviceTracker* GetSyncedDeviceTrackerForTest();
284
280 protected: 285 protected:
281 // The types and functions below are protected so that test 286 // The types and functions below are protected so that test
282 // subclasses can use them. 287 // subclasses can use them.
283 // 288 //
284 // TODO(akalin): Figure out a better way for tests to hook into 289 // TODO(akalin): Figure out a better way for tests to hook into
285 // SyncBackendHost. 290 // SyncBackendHost.
286 291
287 typedef base::Callback<scoped_ptr<syncer::HttpPostProviderFactory>(void)> 292 typedef base::Callback<scoped_ptr<syncer::HttpPostProviderFactory>(void)>
288 MakeHttpBridgeFactoryFn; 293 MakeHttpBridgeFactoryFn;
289 294
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 363
359 SyncFrontend* frontend() { return frontend_; } 364 SyncFrontend* frontend() { return frontend_; }
360 365
361 private: 366 private:
362 // The real guts of SyncBackendHost, to keep the public client API clean. 367 // The real guts of SyncBackendHost, to keep the public client API clean.
363 class Core; 368 class Core;
364 369
365 // An enum representing the steps to initializing the SyncBackendHost. 370 // An enum representing the steps to initializing the SyncBackendHost.
366 enum InitializationState { 371 enum InitializationState {
367 NOT_ATTEMPTED, 372 NOT_ATTEMPTED,
368 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the 373 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the
369 // sync thread to inform us that the sync manager 374 // sync thread to inform us that the sync
370 // has been created. 375 // manager has been created.
371 NOT_INITIALIZED, // Initialization hasn't completed, but we've 376 NOT_INITIALIZED, // Initialization hasn't completed, but we've
372 // constructed a SyncManager. 377 // constructed a SyncManager.
373 DOWNLOADING_NIGORI, // The SyncManager is initialized, but 378 DOWNLOADING_CONTROL_TYPES, // The SyncManager is initialized, but
374 // we're fetching sync encryption information. 379 // we're fetching metadata, such as encryption
375 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we 380 // information, from the server.
376 // have the sync encryption information, but we 381 PROCESSING_CONTROL_TYPES, // Running init tasks that require metadata to
377 // have to update the local encryption state. 382 // be available. This includes registering our
378 INITIALIZED, // Initialization is complete. 383 // device information and refreshing encryption.
384 INITIALIZED, // Initialization is complete.
379 }; 385 };
380 386
381 // Checks if we have received a notice to turn on experimental datatypes 387 // Checks if we have received a notice to turn on experimental datatypes
382 // (via the nigori node) and informs the frontend if that is the case. 388 // (via the nigori node) and informs the frontend if that is the case.
383 // Note: it is illegal to call this before the backend is initialized. 389 // Note: it is illegal to call this before the backend is initialized.
384 void AddExperimentalTypes(); 390 void AddExperimentalTypes();
385 391
386 // Downloading of nigori failed and will be retried. 392 // Downloading of nigori failed and will be retried.
387 void OnNigoriDownloadRetry(); 393 void OnNigoriDownloadRetry();
388 394
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 void HandleInvalidatorStateChangeOnFrontendLoop( 475 void HandleInvalidatorStateChangeOnFrontendLoop(
470 syncer::InvalidatorState state); 476 syncer::InvalidatorState state);
471 void HandleIncomingInvalidationOnFrontendLoop( 477 void HandleIncomingInvalidationOnFrontendLoop(
472 const syncer::ObjectIdStateMap& id_state_map, 478 const syncer::ObjectIdStateMap& id_state_map,
473 syncer::IncomingInvalidationSource source); 479 syncer::IncomingInvalidationSource source);
474 480
475 // Handles stopping the core's SyncManager, accounting for whether 481 // Handles stopping the core's SyncManager, accounting for whether
476 // initialization is done yet. 482 // initialization is done yet.
477 void StopSyncManagerForShutdown(const base::Closure& closure); 483 void StopSyncManagerForShutdown(const base::Closure& closure);
478 484
485 // Must be called on |frontend_loop_|. |done_callback| is called on
486 // |frontend_loop_|.
487 void InitialProcessControlTypes(const base::Closure& done_callback);
488
479 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; 489 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_;
480 490
481 // A thread where all the sync operations happen. 491 // A thread where all the sync operations happen.
482 base::Thread sync_thread_; 492 base::Thread sync_thread_;
483 493
484 // A reference to the MessageLoop used to construct |this|, so we know how 494 // A reference to the MessageLoop used to construct |this|, so we know how
485 // to safely talk back to the SyncFrontend. 495 // to safely talk back to the SyncFrontend.
486 MessageLoop* const frontend_loop_; 496 MessageLoop* const frontend_loop_;
487 497
488 Profile* const profile_; 498 Profile* const profile_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // it via OnBackendInitialized in the final state of 544 // it via OnBackendInitialized in the final state of
535 // HandleInitializationCompletedOnFrontendLoop. 545 // HandleInitializationCompletedOnFrontendLoop.
536 syncer::WeakHandle<syncer::JsBackend> js_backend_; 546 syncer::WeakHandle<syncer::JsBackend> js_backend_;
537 547
538 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 548 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
539 }; 549 };
540 550
541 } // namespace browser_sync 551 } // namespace browser_sync
542 552
543 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 553 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_model_associator_unittest.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