| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "sync/util/unrecoverable_error_handler.h" | 32 #include "sync/util/unrecoverable_error_handler.h" |
| 33 #include "sync/util/weak_handle.h" | 33 #include "sync/util/weak_handle.h" |
| 34 | 34 |
| 35 class MessageLoop; | 35 class MessageLoop; |
| 36 class Profile; | 36 class Profile; |
| 37 | 37 |
| 38 namespace browser_sync { | 38 namespace browser_sync { |
| 39 | 39 |
| 40 class ChangeProcessor; | 40 class ChangeProcessor; |
| 41 struct Experiments; | 41 struct Experiments; |
| 42 class InvalidatorStorage; |
| 42 class JsBackend; | 43 class JsBackend; |
| 43 class JsEventHandler; | 44 class JsEventHandler; |
| 44 class SyncBackendRegistrar; | 45 class SyncBackendRegistrar; |
| 45 class SyncPrefs; | 46 class SyncPrefs; |
| 46 | 47 |
| 47 // SyncFrontend is the interface used by SyncBackendHost to communicate with | 48 // SyncFrontend is the interface used by SyncBackendHost to communicate with |
| 48 // the entity that created it and, presumably, is interested in sync-related | 49 // the entity that created it and, presumably, is interested in sync-related |
| 49 // activity. | 50 // activity. |
| 50 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread | 51 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread |
| 51 // used to create that SyncBackendHost. | 52 // used to create that SyncBackendHost. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // syncapi element, the SyncManager, on its own thread. This class handles | 142 // syncapi element, the SyncManager, on its own thread. This class handles |
| 142 // dispatch of potentially blocking calls to appropriate threads and ensures | 143 // dispatch of potentially blocking calls to appropriate threads and ensures |
| 143 // that the SyncFrontend is only accessed on the UI loop. | 144 // that the SyncFrontend is only accessed on the UI loop. |
| 144 class SyncBackendHost : public BackendDataTypeConfigurer { | 145 class SyncBackendHost : public BackendDataTypeConfigurer { |
| 145 public: | 146 public: |
| 146 typedef sync_api::SyncManager::Status Status; | 147 typedef sync_api::SyncManager::Status Status; |
| 147 | 148 |
| 148 // Create a SyncBackendHost with a reference to the |frontend| that | 149 // Create a SyncBackendHost with a reference to the |frontend| that |
| 149 // it serves and communicates to via the SyncFrontend interface (on | 150 // it serves and communicates to via the SyncFrontend interface (on |
| 150 // the same thread it used to call the constructor). Must outlive | 151 // the same thread it used to call the constructor). Must outlive |
| 151 // |sync_prefs|. | 152 // |sync_prefs| and |invalidator_storage|. |
| 152 SyncBackendHost(const std::string& name, | 153 SyncBackendHost( |
| 153 Profile* profile, | 154 const std::string& name, |
| 154 const base::WeakPtr<SyncPrefs>& sync_prefs); | 155 Profile* profile, |
| 156 const base::WeakPtr<SyncPrefs>& sync_prefs, |
| 157 // TODO(tim): Temporary, remove when bug 124137 finished. |
| 158 const base::WeakPtr<InvalidatorStorage>& invalidator_storage); |
| 159 |
| 155 // For testing. | 160 // For testing. |
| 156 // TODO(skrul): Extract an interface so this is not needed. | 161 // TODO(skrul): Extract an interface so this is not needed. |
| 157 explicit SyncBackendHost(Profile* profile); | 162 explicit SyncBackendHost(Profile* profile); |
| 158 virtual ~SyncBackendHost(); | 163 virtual ~SyncBackendHost(); |
| 159 | 164 |
| 160 // Called on |frontend_loop_| to kick off asynchronous initialization. | 165 // Called on |frontend_loop_| to kick off asynchronous initialization. |
| 161 // As a fallback when no cached auth information is available, try to | 166 // As a fallback when no cached auth information is available, try to |
| 162 // bootstrap authentication using |lsid|, if it isn't empty. | 167 // bootstrap authentication using |lsid|, if it isn't empty. |
| 163 // Optionally delete the Sync Data folder (if it's corrupt). | 168 // Optionally delete the Sync Data folder (if it's corrupt). |
| 164 // |report_unrecoverable_error_function| can be NULL. | 169 // |report_unrecoverable_error_function| can be NULL. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 520 |
| 516 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 521 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 517 sessions::SyncSessionSnapshot last_snapshot_; | 522 sessions::SyncSessionSnapshot last_snapshot_; |
| 518 | 523 |
| 519 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 524 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 520 }; | 525 }; |
| 521 | 526 |
| 522 } // namespace browser_sync | 527 } // namespace browser_sync |
| 523 | 528 |
| 524 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 529 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |