OLD | NEW |
---|---|
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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "chrome/browser/sync/glue/backend_data_type_configurer.h" | 17 #include "chrome/browser/sync/glue/backend_data_type_configurer.h" |
18 #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" | 18 #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" |
19 #include "chrome/common/net/gaia/google_service_auth_error.h" | 19 #include "chrome/common/net/gaia/google_service_auth_error.h" |
20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
21 #include "sync/internal_api/public/base/model_type.h" | 21 #include "sync/internal_api/public/base/model_type.h" |
22 #include "sync/internal_api/public/configure_reason.h" | 22 #include "sync/internal_api/public/configure_reason.h" |
23 #include "sync/internal_api/public/engine/model_safe_worker.h" | 23 #include "sync/internal_api/public/engine/model_safe_worker.h" |
24 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 24 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
25 #include "sync/internal_api/public/sync_encryption_handler.h" | |
25 #include "sync/internal_api/public/sync_manager.h" | 26 #include "sync/internal_api/public/sync_manager.h" |
26 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 27 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
27 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 28 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
28 #include "sync/internal_api/public/util/weak_handle.h" | 29 #include "sync/internal_api/public/util/weak_handle.h" |
29 #include "sync/notifier/sync_notifier_factory.h" | 30 #include "sync/notifier/sync_notifier_factory.h" |
30 #include "sync/notifier/sync_notifier_observer.h" | 31 #include "sync/notifier/sync_notifier_observer.h" |
31 #include "sync/protocol/encryption.pb.h" | 32 #include "sync/protocol/encryption.pb.h" |
32 #include "sync/protocol/sync_protocol_error.h" | 33 #include "sync/protocol/sync_protocol_error.h" |
33 | 34 |
34 class MessageLoop; | 35 class MessageLoop; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 | 363 |
363 // An enum representing the steps to initializing the SyncBackendHost. | 364 // An enum representing the steps to initializing the SyncBackendHost. |
364 enum InitializationState { | 365 enum InitializationState { |
365 NOT_ATTEMPTED, | 366 NOT_ATTEMPTED, |
366 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the | 367 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the |
367 // sync thread to inform us that the sync manager | 368 // sync thread to inform us that the sync manager |
368 // has been created. | 369 // has been created. |
369 NOT_INITIALIZED, // Initialization hasn't completed, but we've | 370 NOT_INITIALIZED, // Initialization hasn't completed, but we've |
370 // constructed a SyncManager. | 371 // constructed a SyncManager. |
371 DOWNLOADING_NIGORI, // The SyncManager is initialized, but | 372 DOWNLOADING_NIGORI, // The SyncManager is initialized, but |
372 // we're fetching encryption information. | 373 // we're fetching sync encryption information. |
373 REFRESHING_NIGORI, // The SyncManager is initialized, and we | 374 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we |
374 // have the encryption information, but we | 375 // have the sync encryption information, but we |
375 // still need to refresh encryption. Also, we need | 376 // have to update the local encryption state. |
376 // to update the device information in the nigori. | |
377 INITIALIZED, // Initialization is complete. | 377 INITIALIZED, // Initialization is complete. |
378 }; | 378 }; |
379 | 379 |
380 // Enum used to distinguish which bootstrap encryption token is being updated. | 380 // Enum used to distinguish which bootstrap encryption token is being updated. |
381 enum BootstrapTokenType { | 381 enum BootstrapTokenType { |
382 PASSPHRASE_BOOTSTRAP_TOKEN, | 382 PASSPHRASE_BOOTSTRAP_TOKEN, |
383 KEYSTORE_BOOTSTRAP_TOKEN | 383 KEYSTORE_BOOTSTRAP_TOKEN |
384 }; | 384 }; |
385 | 385 |
386 // Checks if we have received a notice to turn on experimental datatypes | 386 // Checks if we have received a notice to turn on experimental datatypes |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 syncer::ModelTypeSet failed_configuration_types); | 468 syncer::ModelTypeSet failed_configuration_types); |
469 | 469 |
470 // syncer::SyncNotifierObserver-like functions. | 470 // syncer::SyncNotifierObserver-like functions. |
471 void HandleNotificationsEnabledOnFrontendLoop(); | 471 void HandleNotificationsEnabledOnFrontendLoop(); |
472 void HandleNotificationsDisabledOnFrontendLoop( | 472 void HandleNotificationsDisabledOnFrontendLoop( |
473 syncer::NotificationsDisabledReason reason); | 473 syncer::NotificationsDisabledReason reason); |
474 void HandleIncomingNotificationOnFrontendLoop( | 474 void HandleIncomingNotificationOnFrontendLoop( |
475 const syncer::ObjectIdPayloadMap& id_payloads, | 475 const syncer::ObjectIdPayloadMap& id_payloads, |
476 syncer::IncomingNotificationSource source); | 476 syncer::IncomingNotificationSource source); |
477 | 477 |
478 // Must be called on |frontend_loop_|. |done_callback| is called on | 478 // Must be called on |frontend_loop_|. |done_callback| is called on |
tim (not reviewing)
2012/08/15 00:23:30
Comment references |done_callback|.
Nicolas Zea
2012/08/15 01:08:29
Done.
| |
479 // |frontend_loop_|. | 479 // |frontend_loop_|. |
480 void RefreshNigori(const base::Closure& done_callback); | 480 void AssociateNigori(const syncer::WeakHandle<syncer::JsBackend>& js_backend); |
481 | 481 |
482 // Handles stopping the core's SyncManager, accounting for whether | 482 // Handles stopping the core's SyncManager, accounting for whether |
483 // initialization is done yet. | 483 // initialization is done yet. |
484 void StopSyncManagerForShutdown(const base::Closure& closure); | 484 void StopSyncManagerForShutdown(const base::Closure& closure); |
485 | 485 |
486 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; | 486 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; |
487 | 487 |
488 // A thread where all the sync operations happen. | 488 // A thread where all the sync operations happen. |
489 base::Thread sync_thread_; | 489 base::Thread sync_thread_; |
490 | 490 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 | 529 |
530 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 530 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
531 syncer::sessions::SyncSessionSnapshot last_snapshot_; | 531 syncer::sessions::SyncSessionSnapshot last_snapshot_; |
532 | 532 |
533 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 533 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
534 }; | 534 }; |
535 | 535 |
536 } // namespace browser_sync | 536 } // namespace browser_sync |
537 | 537 |
538 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 538 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |