| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "chrome/browser/sync/glue/backend_data_type_configurer.h" | 18 #include "chrome/browser/sync/glue/backend_data_type_configurer.h" |
| 19 #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" | 19 #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" |
| 20 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" | 20 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" |
| 21 #include "chrome/common/net/gaia/google_service_auth_error.h" | 21 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 23 #include "sync/engine/model_safe_worker.h" | 23 #include "sync/engine/model_safe_worker.h" |
| 24 #include "sync/internal_api/configure_reason.h" | 24 #include "sync/internal_api/configure_reason.h" |
| 25 #include "sync/internal_api/sync_manager.h" | 25 #include "sync/internal_api/sync_manager.h" |
| 26 #include "sync/notifier/sync_notifier_factory.h" | 26 #include "sync/notifier/sync_notifier_factory.h" |
| 27 #include "sync/protocol/encryption.pb.h" | 27 #include "sync/protocol/encryption.pb.h" |
| 28 #include "sync/protocol/sync_protocol_error.h" | 28 #include "sync/protocol/sync_protocol_error.h" |
| 29 #include "sync/sessions/session_state.h" |
| 29 #include "sync/syncable/model_type.h" | 30 #include "sync/syncable/model_type.h" |
| 30 #include "sync/util/report_unrecoverable_error_function.h" | 31 #include "sync/util/report_unrecoverable_error_function.h" |
| 31 #include "sync/util/unrecoverable_error_handler.h" | 32 #include "sync/util/unrecoverable_error_handler.h" |
| 32 #include "sync/util/weak_handle.h" | 33 #include "sync/util/weak_handle.h" |
| 33 | 34 |
| 34 class MessageLoop; | 35 class MessageLoop; |
| 35 class Profile; | 36 class Profile; |
| 36 | 37 |
| 37 namespace browser_sync { | 38 namespace browser_sync { |
| 38 | 39 |
| 39 namespace sessions { | |
| 40 struct SyncSessionSnapshot; | |
| 41 } | |
| 42 | |
| 43 class ChangeProcessor; | 40 class ChangeProcessor; |
| 44 class JsBackend; | 41 class JsBackend; |
| 45 class JsEventHandler; | 42 class JsEventHandler; |
| 46 class SyncBackendRegistrar; | 43 class SyncBackendRegistrar; |
| 47 class SyncPrefs; | 44 class SyncPrefs; |
| 48 | 45 |
| 49 // SyncFrontend is the interface used by SyncBackendHost to communicate with | 46 // SyncFrontend is the interface used by SyncBackendHost to communicate with |
| 50 // the entity that created it and, presumably, is interested in sync-related | 47 // the entity that created it and, presumably, is interested in sync-related |
| 51 // activity. | 48 // activity. |
| 52 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread | 49 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // Asks the server to clear all data associated with ChromeSync. | 246 // Asks the server to clear all data associated with ChromeSync. |
| 250 virtual bool RequestClearServerData(); | 247 virtual bool RequestClearServerData(); |
| 251 | 248 |
| 252 // Called on |frontend_loop_| to obtain a handle to the UserShare needed | 249 // Called on |frontend_loop_| to obtain a handle to the UserShare needed |
| 253 // for creating transactions. | 250 // for creating transactions. |
| 254 sync_api::UserShare* GetUserShare() const; | 251 sync_api::UserShare* GetUserShare() const; |
| 255 | 252 |
| 256 // Called from any thread to obtain current status information in detailed or | 253 // Called from any thread to obtain current status information in detailed or |
| 257 // summarized form. | 254 // summarized form. |
| 258 Status GetDetailedStatus(); | 255 Status GetDetailedStatus(); |
| 259 const sessions::SyncSessionSnapshot* GetLastSessionSnapshot() const; | 256 sessions::SyncSessionSnapshot GetLastSessionSnapshot() const; |
| 260 | 257 |
| 261 // Determines if the underlying sync engine has made any local changes to | 258 // Determines if the underlying sync engine has made any local changes to |
| 262 // items that have not yet been synced with the server. | 259 // items that have not yet been synced with the server. |
| 263 // ONLY CALL THIS IF OnInitializationComplete was called! | 260 // ONLY CALL THIS IF OnInitializationComplete was called! |
| 264 bool HasUnsyncedItems() const; | 261 bool HasUnsyncedItems() const; |
| 265 | 262 |
| 266 // Whether or not we are syncing encryption keys. | 263 // Whether or not we are syncing encryption keys. |
| 267 bool IsNigoriEnabled() const; | 264 bool IsNigoriEnabled() const; |
| 268 | 265 |
| 269 // Whether or not the Nigori node is encrypted using an explicit passphrase. | 266 // Whether or not the Nigori node is encrypted using an explicit passphrase. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 UnrecoverableErrorHandler* unrecoverable_error_handler; | 318 UnrecoverableErrorHandler* unrecoverable_error_handler; |
| 322 ReportUnrecoverableErrorFunction report_unrecoverable_error_function; | 319 ReportUnrecoverableErrorFunction report_unrecoverable_error_function; |
| 323 }; | 320 }; |
| 324 | 321 |
| 325 // Allows tests to perform alternate core initialization work. | 322 // Allows tests to perform alternate core initialization work. |
| 326 virtual void InitCore(const DoInitializeOptions& options); | 323 virtual void InitCore(const DoInitializeOptions& options); |
| 327 | 324 |
| 328 // Called from Core::OnSyncCycleCompleted to handle updating frontend | 325 // Called from Core::OnSyncCycleCompleted to handle updating frontend |
| 329 // thread components. | 326 // thread components. |
| 330 void HandleSyncCycleCompletedOnFrontendLoop( | 327 void HandleSyncCycleCompletedOnFrontendLoop( |
| 331 sessions::SyncSessionSnapshot* snapshot); | 328 const sessions::SyncSessionSnapshot& snapshot); |
| 332 | 329 |
| 333 // Called to finish the job of ConfigureDataTypes once the syncer is in | 330 // Called to finish the job of ConfigureDataTypes once the syncer is in |
| 334 // configuration mode. | 331 // configuration mode. |
| 335 void FinishConfigureDataTypesOnFrontendLoop(); | 332 void FinishConfigureDataTypesOnFrontendLoop(); |
| 336 | 333 |
| 337 bool IsDownloadingNigoriForTest() const; | 334 bool IsDownloadingNigoriForTest() const; |
| 338 | 335 |
| 339 private: | 336 private: |
| 340 // The real guts of SyncBackendHost, to keep the public client API clean. | 337 // The real guts of SyncBackendHost, to keep the public client API clean. |
| 341 class Core; | 338 class Core; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // is called. This way, before the UI calls SetDecryptionPassphrase on the | 505 // is called. This way, before the UI calls SetDecryptionPassphrase on the |
| 509 // syncer, it can avoid the overhead of an asynchronous decryption call and | 506 // syncer, it can avoid the overhead of an asynchronous decryption call and |
| 510 // give the user immediate feedback about the passphrase entered by first | 507 // give the user immediate feedback about the passphrase entered by first |
| 511 // trying to decrypt the cached pending keys on the UI thread. Note that | 508 // trying to decrypt the cached pending keys on the UI thread. Note that |
| 512 // SetDecryptionPassphrase can still fail after the cached pending keys are | 509 // SetDecryptionPassphrase can still fail after the cached pending keys are |
| 513 // successfully decrypted if the pending keys have changed since the time they | 510 // successfully decrypted if the pending keys have changed since the time they |
| 514 // were cached. | 511 // were cached. |
| 515 sync_pb::EncryptedData cached_pending_keys_; | 512 sync_pb::EncryptedData cached_pending_keys_; |
| 516 | 513 |
| 517 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 514 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 518 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 515 sessions::SyncSessionSnapshot last_snapshot_; |
| 519 | 516 |
| 520 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 517 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 521 }; | 518 }; |
| 522 | 519 |
| 523 } // namespace browser_sync | 520 } // namespace browser_sync |
| 524 | 521 |
| 525 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 522 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |