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/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/engine/model_safe_worker.h" | 17 #include "chrome/browser/sync/engine/model_safe_worker.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/internal_api/includes/report_unrecoverable_error_f
unction.h" | 21 #include "chrome/browser/sync/internal_api/includes/report_unrecoverable_error_f
unction.h" |
21 #include "chrome/browser/sync/internal_api/includes/unrecoverable_error_handler.
h" | 22 #include "chrome/browser/sync/internal_api/includes/unrecoverable_error_handler.
h" |
22 #include "chrome/browser/sync/internal_api/configure_reason.h" | 23 #include "chrome/browser/sync/internal_api/configure_reason.h" |
23 #include "chrome/browser/sync/internal_api/sync_manager.h" | 24 #include "chrome/browser/sync/internal_api/sync_manager.h" |
24 #include "chrome/browser/sync/notifier/sync_notifier_factory.h" | 25 #include "chrome/browser/sync/notifier/sync_notifier_factory.h" |
25 #include "chrome/browser/sync/protocol/encryption.pb.h" | 26 #include "chrome/browser/sync/protocol/encryption.pb.h" |
26 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | 27 #include "chrome/browser/sync/protocol/sync_protocol_error.h" |
27 #include "chrome/browser/sync/syncable/model_type.h" | 28 #include "chrome/browser/sync/syncable/model_type.h" |
28 #include "chrome/browser/sync/util/weak_handle.h" | 29 #include "chrome/browser/sync/util/weak_handle.h" |
29 #include "chrome/common/net/gaia/google_service_auth_error.h" | 30 #include "chrome/common/net/gaia/google_service_auth_error.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 283 |
283 struct DoInitializeOptions { | 284 struct DoInitializeOptions { |
284 DoInitializeOptions( | 285 DoInitializeOptions( |
285 MessageLoop* sync_loop, | 286 MessageLoop* sync_loop, |
286 SyncBackendRegistrar* registrar, | 287 SyncBackendRegistrar* registrar, |
287 ExtensionsActivityMonitor* extensions_activity_monitor, | 288 ExtensionsActivityMonitor* extensions_activity_monitor, |
288 const WeakHandle<JsEventHandler>& event_handler, | 289 const WeakHandle<JsEventHandler>& event_handler, |
289 const GURL& service_url, | 290 const GURL& service_url, |
290 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, | 291 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, |
291 const sync_api::SyncCredentials& credentials, | 292 const sync_api::SyncCredentials& credentials, |
| 293 ChromeSyncNotificationBridge* chrome_sync_notification_bridge, |
292 sync_notifier::SyncNotifierFactory* sync_notifier_factory, | 294 sync_notifier::SyncNotifierFactory* sync_notifier_factory, |
293 bool delete_sync_data_folder, | 295 bool delete_sync_data_folder, |
294 const std::string& restored_key_for_bootstrapping, | 296 const std::string& restored_key_for_bootstrapping, |
295 bool setup_for_test_mode, | 297 bool setup_for_test_mode, |
296 UnrecoverableErrorHandler* unrecoverable_error_handler, | 298 UnrecoverableErrorHandler* unrecoverable_error_handler, |
297 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); | 299 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); |
298 ~DoInitializeOptions(); | 300 ~DoInitializeOptions(); |
299 | 301 |
300 MessageLoop* sync_loop; | 302 MessageLoop* sync_loop; |
301 SyncBackendRegistrar* registrar; | 303 SyncBackendRegistrar* registrar; |
302 ExtensionsActivityMonitor* extensions_activity_monitor; | 304 ExtensionsActivityMonitor* extensions_activity_monitor; |
303 WeakHandle<JsEventHandler> event_handler; | 305 WeakHandle<JsEventHandler> event_handler; |
304 GURL service_url; | 306 GURL service_url; |
305 // Overridden by tests. | 307 // Overridden by tests. |
306 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn; | 308 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn; |
307 sync_api::SyncCredentials credentials; | 309 sync_api::SyncCredentials credentials; |
| 310 ChromeSyncNotificationBridge* const chrome_sync_notification_bridge; |
308 sync_notifier::SyncNotifierFactory* const sync_notifier_factory; | 311 sync_notifier::SyncNotifierFactory* const sync_notifier_factory; |
309 std::string lsid; | 312 std::string lsid; |
310 bool delete_sync_data_folder; | 313 bool delete_sync_data_folder; |
311 std::string restored_key_for_bootstrapping; | 314 std::string restored_key_for_bootstrapping; |
312 bool setup_for_test_mode; | 315 bool setup_for_test_mode; |
313 UnrecoverableErrorHandler* unrecoverable_error_handler; | 316 UnrecoverableErrorHandler* unrecoverable_error_handler; |
314 ReportUnrecoverableErrorFunction report_unrecoverable_error_function; | 317 ReportUnrecoverableErrorFunction report_unrecoverable_error_function; |
315 }; | 318 }; |
316 | 319 |
317 // Allows tests to perform alternate core initialization work. | 320 // Allows tests to perform alternate core initialization work. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // Name used for debugging (set from profile_->GetDebugName()). | 479 // Name used for debugging (set from profile_->GetDebugName()). |
477 const std::string name_; | 480 const std::string name_; |
478 | 481 |
479 // Our core, which communicates directly to the syncapi. | 482 // Our core, which communicates directly to the syncapi. |
480 scoped_refptr<Core> core_; | 483 scoped_refptr<Core> core_; |
481 | 484 |
482 InitializationState initialization_state_; | 485 InitializationState initialization_state_; |
483 | 486 |
484 const base::WeakPtr<SyncPrefs> sync_prefs_; | 487 const base::WeakPtr<SyncPrefs> sync_prefs_; |
485 | 488 |
| 489 // A thread-safe listener for handling notifications triggered by |
| 490 // chrome events. |
| 491 ChromeSyncNotificationBridge chrome_sync_notification_bridge_; |
| 492 |
486 sync_notifier::SyncNotifierFactory sync_notifier_factory_; | 493 sync_notifier::SyncNotifierFactory sync_notifier_factory_; |
487 | 494 |
488 ChromeExtensionsActivityMonitor extensions_activity_monitor_; | 495 ChromeExtensionsActivityMonitor extensions_activity_monitor_; |
489 | 496 |
490 scoped_ptr<SyncBackendRegistrar> registrar_; | 497 scoped_ptr<SyncBackendRegistrar> registrar_; |
491 | 498 |
492 // The frontend which we serve (and are owned by). | 499 // The frontend which we serve (and are owned by). |
493 SyncFrontend* frontend_; | 500 SyncFrontend* frontend_; |
494 | 501 |
495 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; | 502 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; |
(...skipping 11 matching lines...) Expand all Loading... |
507 | 514 |
508 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 515 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
509 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 516 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
510 | 517 |
511 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 518 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
512 }; | 519 }; |
513 | 520 |
514 } // namespace browser_sync | 521 } // namespace browser_sync |
515 | 522 |
516 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 523 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |