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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 namespace invalidation { | 40 namespace invalidation { |
41 class InvalidationService; | 41 class InvalidationService; |
42 } | 42 } |
43 | 43 |
44 namespace syncer { | 44 namespace syncer { |
45 class NetworkResources; | 45 class NetworkResources; |
46 class SyncManagerFactory; | 46 class SyncManagerFactory; |
47 } | 47 } |
48 | 48 |
| 49 namespace sync_driver { |
| 50 class SyncPrefs; |
| 51 } |
| 52 |
49 namespace browser_sync { | 53 namespace browser_sync { |
50 | 54 |
51 class ChangeProcessor; | 55 class ChangeProcessor; |
52 class SyncBackendHostCore; | 56 class SyncBackendHostCore; |
53 class SyncBackendRegistrar; | 57 class SyncBackendRegistrar; |
54 class SyncPrefs; | |
55 class SyncedDeviceTracker; | 58 class SyncedDeviceTracker; |
56 struct DoInitializeOptions; | 59 struct DoInitializeOptions; |
57 | 60 |
58 // The only real implementation of the SyncBackendHost. See that interface's | 61 // The only real implementation of the SyncBackendHost. See that interface's |
59 // definition for documentation of public methods. | 62 // definition for documentation of public methods. |
60 class SyncBackendHostImpl | 63 class SyncBackendHostImpl |
61 : public SyncBackendHost, | 64 : public SyncBackendHost, |
62 public content::NotificationObserver, | 65 public content::NotificationObserver, |
63 public syncer::InvalidationHandler { | 66 public syncer::InvalidationHandler { |
64 public: | 67 public: |
65 typedef syncer::SyncStatus Status; | 68 typedef syncer::SyncStatus Status; |
66 | 69 |
67 // Create a SyncBackendHost with a reference to the |frontend| that | 70 // Create a SyncBackendHost with a reference to the |frontend| that |
68 // it serves and communicates to via the SyncFrontend interface (on | 71 // it serves and communicates to via the SyncFrontend interface (on |
69 // the same thread it used to call the constructor). Must outlive | 72 // the same thread it used to call the constructor). Must outlive |
70 // |sync_prefs|. | 73 // |sync_prefs|. |
71 SyncBackendHostImpl( | 74 SyncBackendHostImpl(const std::string& name, |
72 const std::string& name, | 75 Profile* profile, |
73 Profile* profile, | 76 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs); |
74 const base::WeakPtr<SyncPrefs>& sync_prefs); | |
75 virtual ~SyncBackendHostImpl(); | 77 virtual ~SyncBackendHostImpl(); |
76 | 78 |
77 // SyncBackendHost implementation. | 79 // SyncBackendHost implementation. |
78 virtual void Initialize( | 80 virtual void Initialize( |
79 SyncFrontend* frontend, | 81 SyncFrontend* frontend, |
80 scoped_ptr<base::Thread> sync_thread, | 82 scoped_ptr<base::Thread> sync_thread, |
81 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 83 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
82 const GURL& service_url, | 84 const GURL& service_url, |
83 const syncer::SyncCredentials& credentials, | 85 const syncer::SyncCredentials& credentials, |
84 bool delete_sync_data_folder, | 86 bool delete_sync_data_folder, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Name used for debugging (set from profile_->GetDebugName()). | 275 // Name used for debugging (set from profile_->GetDebugName()). |
274 const std::string name_; | 276 const std::string name_; |
275 | 277 |
276 // Our core, which communicates directly to the syncapi. Use refptr instead | 278 // Our core, which communicates directly to the syncapi. Use refptr instead |
277 // of WeakHandle because |core_| is created on UI loop but released on | 279 // of WeakHandle because |core_| is created on UI loop but released on |
278 // sync loop. | 280 // sync loop. |
279 scoped_refptr<SyncBackendHostCore> core_; | 281 scoped_refptr<SyncBackendHostCore> core_; |
280 | 282 |
281 bool initialized_; | 283 bool initialized_; |
282 | 284 |
283 const base::WeakPtr<SyncPrefs> sync_prefs_; | 285 const base::WeakPtr<sync_driver::SyncPrefs> sync_prefs_; |
284 | 286 |
285 ExtensionsActivityMonitor extensions_activity_monitor_; | 287 ExtensionsActivityMonitor extensions_activity_monitor_; |
286 | 288 |
287 scoped_ptr<SyncBackendRegistrar> registrar_; | 289 scoped_ptr<SyncBackendRegistrar> registrar_; |
288 | 290 |
289 // The frontend which we serve (and are owned by). | 291 // The frontend which we serve (and are owned by). |
290 SyncFrontend* frontend_; | 292 SyncFrontend* frontend_; |
291 | 293 |
292 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired | 294 // We cache the cryptographer's pending keys whenever NotifyPassphraseRequired |
293 // is called. This way, before the UI calls SetDecryptionPassphrase on the | 295 // is called. This way, before the UI calls SetDecryptionPassphrase on the |
(...skipping 23 matching lines...) Expand all Loading... |
317 | 319 |
318 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; | 320 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; |
319 | 321 |
320 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); | 322 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); |
321 }; | 323 }; |
322 | 324 |
323 } // namespace browser_sync | 325 } // namespace browser_sync |
324 | 326 |
325 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ | 327 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_IMPL_H_ |
326 | 328 |
OLD | NEW |