OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SYNC_API_COMPONENT_FACTORY_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ |
6 #define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "sync/api/attachments/attachment_store.h" | 10 #include "sync/api/attachments/attachment_service.h" |
11 #include "sync/api/syncable_service.h" | 11 #include "sync/api/syncable_service.h" |
12 #include "sync/internal_api/public/base/model_type.h" | 12 #include "sync/internal_api/public/base/model_type.h" |
13 | 13 |
14 namespace browser_sync { | 14 namespace browser_sync { |
15 | 15 |
16 // This factory provides sync driver code with the model type specific sync/api | 16 // This factory provides sync driver code with the model type specific sync/api |
17 // service (like SyncableService) implementations. | 17 // service (like SyncableService) implementations. |
18 class SyncApiComponentFactory { | 18 class SyncApiComponentFactory { |
19 public: | 19 public: |
| 20 virtual ~SyncApiComponentFactory() {} |
| 21 |
20 // Returns a weak pointer to the syncable service specified by |type|. | 22 // Returns a weak pointer to the syncable service specified by |type|. |
21 // Weak pointer may be unset if service is already destroyed. | 23 // Weak pointer may be unset if service is already destroyed. |
22 // Note: Should only be called from the model type thread. | 24 // Note: Should only be called from the model type thread. |
23 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 25 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( |
24 syncer::ModelType type) = 0; | 26 syncer::ModelType type) = 0; |
25 | 27 |
26 // Returns the custom attachment store for a model type, if there is one. | 28 // Creates attachment service. |
27 // May return NULL, which implies sync should use a default implementation. | |
28 // Note: Should only be called from the model type thread. | 29 // Note: Should only be called from the model type thread. |
29 virtual scoped_ptr<syncer::AttachmentStore> | 30 // |delegate| is optional delegate for AttachmentService to notify about |
30 CreateCustomAttachmentStoreForType(syncer::ModelType type) = 0; | 31 // asynchronous events (AttachmentUploaded). Pass NULL if delegate is not |
| 32 // provided. AttachmentService doesn't take ownership of delegate, the pointer |
| 33 // must be valid throughout AttachmentService lifetime. |
| 34 virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService( |
| 35 syncer::AttachmentService::Delegate* delegate) = 0; |
31 }; | 36 }; |
32 | 37 |
33 } // namespace browser_sync | 38 } // namespace browser_sync |
34 | 39 |
35 #endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ | 40 #endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ |
OLD | NEW |