Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/sync/profile_sync_components_factory.h

Issue 10662035: [Sync] Put everything in sync/api into csync namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PROFILE_SYNC_COMPONENTS_FACTORY_H__ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/sync/glue/data_type_controller.h" 12 #include "chrome/browser/sync/glue/data_type_controller.h"
13 #include "chrome/browser/sync/glue/data_type_error_handler.h" 13 #include "chrome/browser/sync/glue/data_type_error_handler.h"
14 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 14 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
15 15
16 class PasswordStore; 16 class PasswordStore;
17 class ProfileSyncService; 17 class ProfileSyncService;
18 class SyncableService;
19 class WebDataService; 18 class WebDataService;
20 19
21 namespace browser_sync { 20 namespace browser_sync {
22 class AssociatorInterface; 21 class AssociatorInterface;
23 class ChangeProcessor; 22 class ChangeProcessor;
24 class DataTypeManager; 23 class DataTypeManager;
25 class GenericChangeProcessor; 24 class GenericChangeProcessor;
26 class SharedChangeProcessor; 25 class SharedChangeProcessor;
27 class SyncBackendHost; 26 class SyncBackendHost;
28 class DataTypeErrorHandler; 27 class DataTypeErrorHandler;
29 } 28 }
30 29
30 namespace csync {
31 class SyncableService;
32 }
33
31 namespace history { 34 namespace history {
32 class HistoryBackend; 35 class HistoryBackend;
33 }; 36 }
34 37
35 // Factory class for all profile sync related classes. 38 // Factory class for all profile sync related classes.
36 class ProfileSyncComponentsFactory { 39 class ProfileSyncComponentsFactory {
37 public: 40 public:
38 // The various factory methods for the data type model associators 41 // The various factory methods for the data type model associators
39 // and change processors all return this struct. This is needed 42 // and change processors all return this struct. This is needed
40 // because the change processors typically require a type-specific 43 // because the change processors typically require a type-specific
41 // model associator at construction time. 44 // model associator at construction time.
42 // 45 //
43 // Note: This interface is deprecated in favor of the SyncableService API. 46 // Note: This interface is deprecated in favor of the SyncableService API.
44 // New datatypes that do not live on the UI thread should directly return a 47 // New datatypes that do not live on the UI thread should directly return a
45 // weak pointer to a SyncableService. All others continue to return 48 // weak pointer to a csync::SyncableService. All others continue to return
46 // SyncComponents. It is safe to assume that the factory methods below are 49 // SyncComponents. It is safe to assume that the factory methods below are
47 // called on the same thread in which the datatype resides. 50 // called on the same thread in which the datatype resides.
48 // 51 //
49 // TODO(zea): Have all datatypes using the new API switch to returning 52 // TODO(zea): Have all datatypes using the new API switch to returning
50 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114). 53 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114).
51 struct SyncComponents { 54 struct SyncComponents {
52 browser_sync::AssociatorInterface* model_associator; 55 browser_sync::AssociatorInterface* model_associator;
53 browser_sync::ChangeProcessor* change_processor; 56 browser_sync::ChangeProcessor* change_processor;
54 SyncComponents(browser_sync::AssociatorInterface* ma, 57 SyncComponents(browser_sync::AssociatorInterface* ma,
55 browser_sync::ChangeProcessor* cp) 58 browser_sync::ChangeProcessor* cp)
(...skipping 10 matching lines...) Expand all
66 // list of data type controllers. The return pointer is owned by 69 // list of data type controllers. The return pointer is owned by
67 // the caller. 70 // the caller.
68 virtual browser_sync::DataTypeManager* CreateDataTypeManager( 71 virtual browser_sync::DataTypeManager* CreateDataTypeManager(
69 browser_sync::SyncBackendHost* backend, 72 browser_sync::SyncBackendHost* backend,
70 const browser_sync::DataTypeController::TypeMap* controllers) = 0; 73 const browser_sync::DataTypeController::TypeMap* controllers) = 0;
71 74
72 // Creating this in the factory helps us mock it out in testing. 75 // Creating this in the factory helps us mock it out in testing.
73 virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor( 76 virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor(
74 ProfileSyncService* profile_sync_service, 77 ProfileSyncService* profile_sync_service,
75 browser_sync::DataTypeErrorHandler* error_handler, 78 browser_sync::DataTypeErrorHandler* error_handler,
76 const base::WeakPtr<SyncableService>& local_service) = 0; 79 const base::WeakPtr<csync::SyncableService>& local_service) = 0;
77 80
78 virtual browser_sync::SharedChangeProcessor* 81 virtual browser_sync::SharedChangeProcessor*
79 CreateSharedChangeProcessor() = 0; 82 CreateSharedChangeProcessor() = 0;
80 83
81 // Returns a weak pointer to the syncable service specified by |type|. 84 // Returns a weak pointer to the syncable service specified by |type|.
82 // Weak pointer may be unset if service is already destroyed. 85 // Weak pointer may be unset if service is already destroyed.
83 // Note: Should only be called on the same thread on which a datatype resides. 86 // Note: Should only be called on the same thread on which a datatype resides.
84 virtual base::WeakPtr<SyncableService> GetSyncableServiceForType( 87 virtual base::WeakPtr<csync::SyncableService> GetSyncableServiceForType(
85 syncable::ModelType type) = 0; 88 syncable::ModelType type) = 0;
86 89
87 // Legacy datatypes that need to be converted to the SyncableService API. 90 // Legacy datatypes that need to be converted to the SyncableService API.
88 virtual SyncComponents CreateBookmarkSyncComponents( 91 virtual SyncComponents CreateBookmarkSyncComponents(
89 ProfileSyncService* profile_sync_service, 92 ProfileSyncService* profile_sync_service,
90 browser_sync::DataTypeErrorHandler* error_handler) = 0; 93 browser_sync::DataTypeErrorHandler* error_handler) = 0;
91 virtual SyncComponents CreatePasswordSyncComponents( 94 virtual SyncComponents CreatePasswordSyncComponents(
92 ProfileSyncService* profile_sync_service, 95 ProfileSyncService* profile_sync_service,
93 PasswordStore* password_store, 96 PasswordStore* password_store,
94 browser_sync::DataTypeErrorHandler* error_handler) = 0; 97 browser_sync::DataTypeErrorHandler* error_handler) = 0;
95 #if defined(ENABLE_THEMES) 98 #if defined(ENABLE_THEMES)
96 virtual SyncComponents CreateThemeSyncComponents( 99 virtual SyncComponents CreateThemeSyncComponents(
97 ProfileSyncService* profile_sync_service, 100 ProfileSyncService* profile_sync_service,
98 browser_sync::DataTypeErrorHandler* error_handler) = 0; 101 browser_sync::DataTypeErrorHandler* error_handler) = 0;
99 #endif 102 #endif
100 virtual SyncComponents CreateTypedUrlSyncComponents( 103 virtual SyncComponents CreateTypedUrlSyncComponents(
101 ProfileSyncService* profile_sync_service, 104 ProfileSyncService* profile_sync_service,
102 history::HistoryBackend* history_backend, 105 history::HistoryBackend* history_backend,
103 browser_sync::DataTypeErrorHandler* error_handler) = 0; 106 browser_sync::DataTypeErrorHandler* error_handler) = 0;
104 virtual SyncComponents CreateSessionSyncComponents( 107 virtual SyncComponents CreateSessionSyncComponents(
105 ProfileSyncService* profile_sync_service, 108 ProfileSyncService* profile_sync_service,
106 browser_sync::DataTypeErrorHandler* error_handler) = 0; 109 browser_sync::DataTypeErrorHandler* error_handler) = 0;
107 }; 110 };
108 111
109 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__ 112 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698