| 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_CORE_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "components/sync/engine/sync_encryption_handler.h" | 28 #include "components/sync/engine/sync_encryption_handler.h" |
| 29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 30 | 30 |
| 31 namespace syncer { | 31 namespace syncer { |
| 32 | 32 |
| 33 class SyncBackendHostImpl; | 33 class SyncBackendHostImpl; |
| 34 | 34 |
| 35 class SyncBackendHostCore | 35 class SyncBackendHostCore |
| 36 : public base::RefCountedThreadSafe<SyncBackendHostCore>, | 36 : public base::RefCountedThreadSafe<SyncBackendHostCore>, |
| 37 public base::trace_event::MemoryDumpProvider, | 37 public base::trace_event::MemoryDumpProvider, |
| 38 public SyncEncryptionHandler::Observer, | |
| 39 public SyncManager::Observer, | 38 public SyncManager::Observer, |
| 40 public TypeDebugInfoObserver { | 39 public TypeDebugInfoObserver { |
| 41 public: | 40 public: |
| 42 SyncBackendHostCore(const std::string& name, | 41 SyncBackendHostCore(const std::string& name, |
| 43 const base::FilePath& sync_data_folder, | 42 const base::FilePath& sync_data_folder, |
| 44 const base::WeakPtr<SyncBackendHostImpl>& backend); | 43 const base::WeakPtr<SyncBackendHostImpl>& backend); |
| 45 | 44 |
| 46 // MemoryDumpProvider implementation. | 45 // MemoryDumpProvider implementation. |
| 47 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 46 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 48 base::trace_event::ProcessMemoryDump* pmd) override; | 47 base::trace_event::ProcessMemoryDump* pmd) override; |
| 49 | 48 |
| 50 // SyncManager::Observer implementation. The Core just acts like an air | 49 // SyncManager::Observer implementation. The Core just acts like an air |
| 51 // traffic controller here, forwarding incoming messages to appropriate | 50 // traffic controller here, forwarding incoming messages to appropriate |
| 52 // landing threads. | 51 // landing threads. |
| 53 void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; | 52 void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; |
| 54 void OnInitializationComplete( | 53 void OnInitializationComplete( |
| 55 const WeakHandle<JsBackend>& js_backend, | 54 const WeakHandle<JsBackend>& js_backend, |
| 56 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | 55 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
| 57 bool success, | 56 bool success, |
| 58 ModelTypeSet restored_types) override; | 57 ModelTypeSet restored_types) override; |
| 59 void OnConnectionStatusChange(ConnectionStatus status) override; | 58 void OnConnectionStatusChange(ConnectionStatus status) override; |
| 60 void OnActionableError(const SyncProtocolError& sync_error) override; | 59 void OnActionableError(const SyncProtocolError& sync_error) override; |
| 61 void OnMigrationRequested(ModelTypeSet types) override; | 60 void OnMigrationRequested(ModelTypeSet types) override; |
| 62 void OnProtocolEvent(const ProtocolEvent& event) override; | 61 void OnProtocolEvent(const ProtocolEvent& event) override; |
| 63 | 62 |
| 64 // SyncEncryptionHandler::Observer implementation. | |
| 65 void OnPassphraseRequired( | |
| 66 PassphraseRequiredReason reason, | |
| 67 const sync_pb::EncryptedData& pending_keys) override; | |
| 68 void OnPassphraseAccepted() override; | |
| 69 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, | |
| 70 BootstrapTokenType type) override; | |
| 71 void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | |
| 72 bool encrypt_everything) override; | |
| 73 void OnEncryptionComplete() override; | |
| 74 void OnCryptographerStateChanged(Cryptographer* cryptographer) override; | |
| 75 void OnPassphraseTypeChanged(PassphraseType type, | |
| 76 base::Time passphrase_time) override; | |
| 77 void OnLocalSetPassphraseEncryption( | |
| 78 const SyncEncryptionHandler::NigoriState& nigori_state) override; | |
| 79 | |
| 80 // TypeDebugInfoObserver implementation | 63 // TypeDebugInfoObserver implementation |
| 81 void OnCommitCountersUpdated(ModelType type, | 64 void OnCommitCountersUpdated(ModelType type, |
| 82 const CommitCounters& counters) override; | 65 const CommitCounters& counters) override; |
| 83 void OnUpdateCountersUpdated(ModelType type, | 66 void OnUpdateCountersUpdated(ModelType type, |
| 84 const UpdateCounters& counters) override; | 67 const UpdateCounters& counters) override; |
| 85 void OnStatusCountersUpdated(ModelType type, | 68 void OnStatusCountersUpdated(ModelType type, |
| 86 const StatusCounters& counters) override; | 69 const StatusCounters& counters) override; |
| 87 | 70 |
| 88 // Forwards an invalidation state change to the sync manager. | 71 // Forwards an invalidation state change to the sync manager. |
| 89 void DoOnInvalidatorStateChange(InvalidatorState state); | 72 void DoOnInvalidatorStateChange(InvalidatorState state); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const std::string name_; | 184 const std::string name_; |
| 202 | 185 |
| 203 // Path of the folder that stores the sync data files. | 186 // Path of the folder that stores the sync data files. |
| 204 const base::FilePath sync_data_folder_; | 187 const base::FilePath sync_data_folder_; |
| 205 | 188 |
| 206 // Our parent SyncBackendHostImpl. | 189 // Our parent SyncBackendHostImpl. |
| 207 WeakHandle<SyncBackendHostImpl> host_; | 190 WeakHandle<SyncBackendHostImpl> host_; |
| 208 | 191 |
| 209 // Non-null only between calls to DoInitialize() and DoShutdown(). | 192 // Non-null only between calls to DoInitialize() and DoShutdown(). |
| 210 std::unique_ptr<SyncBackendRegistrar> registrar_; | 193 std::unique_ptr<SyncBackendRegistrar> registrar_; |
| 194 std::unique_ptr<SyncEncryptionHandler::Observer> encryption_observer_proxy_; |
| 211 | 195 |
| 212 // The timer used to periodically call SaveChanges. | 196 // The timer used to periodically call SaveChanges. |
| 213 std::unique_ptr<base::RepeatingTimer> save_changes_timer_; | 197 std::unique_ptr<base::RepeatingTimer> save_changes_timer_; |
| 214 | 198 |
| 215 // Our encryptor, which uses Chrome's encryption functions. | 199 // Our encryptor, which uses Chrome's encryption functions. |
| 216 SystemEncryptor encryptor_; | 200 SystemEncryptor encryptor_; |
| 217 | 201 |
| 218 // The top-level syncapi entry point. Lives on the sync thread. | 202 // The top-level syncapi entry point. Lives on the sync thread. |
| 219 std::unique_ptr<SyncManager> sync_manager_; | 203 std::unique_ptr<SyncManager> sync_manager_; |
| 220 | 204 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 248 base::ThreadChecker thread_checker_; | 232 base::ThreadChecker thread_checker_; |
| 249 | 233 |
| 250 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; | 234 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; |
| 251 | 235 |
| 252 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); | 236 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); |
| 253 }; | 237 }; |
| 254 | 238 |
| 255 } // namespace syncer | 239 } // namespace syncer |
| 256 | 240 |
| 257 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 241 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
| OLD | NEW |