| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 22 #include "components/invalidation/public/invalidation_handler.h" | 22 #include "components/invalidation/public/invalidation_handler.h" |
| 23 #include "components/sync/base/extensions_activity.h" | 23 #include "components/sync/base/extensions_activity.h" |
| 24 #include "components/sync/base/model_type.h" | 24 #include "components/sync/base/model_type.h" |
| 25 #include "components/sync/base/weak_handle.h" | 25 #include "components/sync/base/weak_handle.h" |
| 26 #include "components/sync/core/configure_reason.h" | 26 #include "components/sync/core/configure_reason.h" |
| 27 #include "components/sync/core/sync_manager.h" | 27 #include "components/sync/core/sync_manager.h" |
| 28 #include "components/sync/driver/backend_data_type_configurer.h" | 28 #include "components/sync/driver/backend_data_type_configurer.h" |
| 29 #include "components/sync/driver/glue/sync_backend_host.h" | 29 #include "components/sync/driver/glue/sync_backend_host.h" |
| 30 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
| 31 #include "components/sync/engine/cycle/type_debug_info_observer.h" |
| 30 #include "components/sync/protocol/encryption.pb.h" | 32 #include "components/sync/protocol/encryption.pb.h" |
| 31 #include "components/sync/protocol/sync_protocol_error.h" | 33 #include "components/sync/protocol/sync_protocol_error.h" |
| 32 #include "components/sync/sessions/sync_session_snapshot.h" | |
| 33 #include "components/sync/sessions/type_debug_info_observer.h" | |
| 34 | 34 |
| 35 class GURL; | 35 class GURL; |
| 36 | 36 |
| 37 namespace base { | 37 namespace base { |
| 38 class MessageLoop; | 38 class MessageLoop; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace invalidation { | 41 namespace invalidation { |
| 42 class InvalidationService; | 42 class InvalidationService; |
| 43 } | 43 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 syncer::ModelSafeGroup group, | 119 syncer::ModelSafeGroup group, |
| 120 sync_driver::ChangeProcessor* change_processor) override; | 120 sync_driver::ChangeProcessor* change_processor) override; |
| 121 void DeactivateDirectoryDataType(syncer::ModelType type) override; | 121 void DeactivateDirectoryDataType(syncer::ModelType type) override; |
| 122 void ActivateNonBlockingDataType( | 122 void ActivateNonBlockingDataType( |
| 123 syncer::ModelType type, | 123 syncer::ModelType type, |
| 124 std::unique_ptr<syncer_v2::ActivationContext>) override; | 124 std::unique_ptr<syncer_v2::ActivationContext>) override; |
| 125 void DeactivateNonBlockingDataType(syncer::ModelType type) override; | 125 void DeactivateNonBlockingDataType(syncer::ModelType type) override; |
| 126 void EnableEncryptEverything() override; | 126 void EnableEncryptEverything() override; |
| 127 syncer::UserShare* GetUserShare() const override; | 127 syncer::UserShare* GetUserShare() const override; |
| 128 Status GetDetailedStatus() override; | 128 Status GetDetailedStatus() override; |
| 129 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; | 129 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; |
| 130 bool HasUnsyncedItems() const override; | 130 bool HasUnsyncedItems() const override; |
| 131 bool IsNigoriEnabled() const override; | 131 bool IsNigoriEnabled() const override; |
| 132 syncer::PassphraseType GetPassphraseType() const override; | 132 syncer::PassphraseType GetPassphraseType() const override; |
| 133 base::Time GetExplicitPassphraseTime() const override; | 133 base::Time GetExplicitPassphraseTime() const override; |
| 134 bool IsCryptographerReady( | 134 bool IsCryptographerReady( |
| 135 const syncer::BaseTransaction* trans) const override; | 135 const syncer::BaseTransaction* trans) const override; |
| 136 void GetModelSafeRoutingInfo( | 136 void GetModelSafeRoutingInfo( |
| 137 syncer::ModelSafeRoutingInfo* out) const override; | 137 syncer::ModelSafeRoutingInfo* out) const override; |
| 138 void FlushDirectory() const override; | 138 void FlushDirectory() const override; |
| 139 void RequestBufferedProtocolEventsAndEnableForwarding() override; | 139 void RequestBufferedProtocolEventsAndEnableForwarding() override; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // (via the nigori node) and informs the frontend if that is the case. | 237 // (via the nigori node) and informs the frontend if that is the case. |
| 238 // Note: it is illegal to call this before the backend is initialized. | 238 // Note: it is illegal to call this before the backend is initialized. |
| 239 void AddExperimentalTypes(); | 239 void AddExperimentalTypes(); |
| 240 | 240 |
| 241 // Handles backend initialization failure. | 241 // Handles backend initialization failure. |
| 242 void HandleInitializationFailureOnFrontendLoop(); | 242 void HandleInitializationFailureOnFrontendLoop(); |
| 243 | 243 |
| 244 // Called from Core::OnSyncCycleCompleted to handle updating frontend | 244 // Called from Core::OnSyncCycleCompleted to handle updating frontend |
| 245 // thread components. | 245 // thread components. |
| 246 void HandleSyncCycleCompletedOnFrontendLoop( | 246 void HandleSyncCycleCompletedOnFrontendLoop( |
| 247 const syncer::sessions::SyncSessionSnapshot& snapshot); | 247 const syncer::SyncCycleSnapshot& snapshot); |
| 248 | 248 |
| 249 // Called when the syncer failed to perform a configuration and will | 249 // Called when the syncer failed to perform a configuration and will |
| 250 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called | 250 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called |
| 251 // on successful completion. | 251 // on successful completion. |
| 252 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback); | 252 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback); |
| 253 | 253 |
| 254 // Helpers to persist a token that can be used to bootstrap sync encryption | 254 // Helpers to persist a token that can be used to bootstrap sync encryption |
| 255 // across browser restart to avoid requiring the user to re-enter their | 255 // across browser restart to avoid requiring the user to re-enter their |
| 256 // passphrase. |token| must be valid UTF-8 as we use the PrefService for | 256 // passphrase. |token| must be valid UTF-8 as we use the PrefService for |
| 257 // storage. | 257 // storage. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // The state of the passphrase required to decrypt the bag of encryption keys | 358 // The state of the passphrase required to decrypt the bag of encryption keys |
| 359 // in the nigori node. Updated whenever a new nigori node arrives or the user | 359 // in the nigori node. Updated whenever a new nigori node arrives or the user |
| 360 // manually changes their passphrase state. Cached so we can synchronously | 360 // manually changes their passphrase state. Cached so we can synchronously |
| 361 // check it from the UI thread. | 361 // check it from the UI thread. |
| 362 syncer::PassphraseType cached_passphrase_type_; | 362 syncer::PassphraseType cached_passphrase_type_; |
| 363 | 363 |
| 364 // If an explicit passphrase is in use, the time at which the passphrase was | 364 // If an explicit passphrase is in use, the time at which the passphrase was |
| 365 // first set (if available). | 365 // first set (if available). |
| 366 base::Time cached_explicit_passphrase_time_; | 366 base::Time cached_explicit_passphrase_time_; |
| 367 | 367 |
| 368 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 368 // UI-thread cache of the last SyncCycleSnapshot received from syncapi. |
| 369 syncer::sessions::SyncSessionSnapshot last_snapshot_; | 369 syncer::SyncCycleSnapshot last_snapshot_; |
| 370 | 370 |
| 371 invalidation::InvalidationService* invalidator_; | 371 invalidation::InvalidationService* invalidator_; |
| 372 bool invalidation_handler_registered_; | 372 bool invalidation_handler_registered_; |
| 373 | 373 |
| 374 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 374 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
| 375 | 375 |
| 376 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 376 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
| 377 }; | 377 }; |
| 378 | 378 |
| 379 } // namespace browser_sync | 379 } // namespace browser_sync |
| 380 | 380 |
| 381 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 381 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
| OLD | NEW |