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

Side by Side Diff: chrome/browser/sync/profile_sync_factory_impl.cc

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copy paste :( Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/sync/glue/app_data_type_controller.h" 7 #include "chrome/browser/sync/glue/app_data_type_controller.h"
8 #include "chrome/browser/sync/glue/autofill_change_processor.h" 8 #include "chrome/browser/sync/glue/autofill_change_processor.h"
9 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" 9 #include "chrome/browser/sync/glue/autofill_data_type_controller.h"
10 #include "chrome/browser/sync/glue/autofill_model_associator.h" 10 #include "chrome/browser/sync/glue/autofill_model_associator.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 CommandLine* command_line) 80 CommandLine* command_line)
81 : profile_(profile), 81 : profile_(profile),
82 command_line_(command_line) { 82 command_line_(command_line) {
83 } 83 }
84 84
85 ProfileSyncService* ProfileSyncFactoryImpl::CreateProfileSyncService( 85 ProfileSyncService* ProfileSyncFactoryImpl::CreateProfileSyncService(
86 const std::string& cros_user) { 86 const std::string& cros_user) {
87 87
88 ProfileSyncService* pss = new ProfileSyncService( 88 ProfileSyncService* pss = new ProfileSyncService(
89 this, profile_, cros_user); 89 this, profile_, cros_user);
90 return pss;
91 }
90 92
93 void ProfileSyncFactoryImpl::RegisterDataTypes(ProfileSyncService* pss) {
91 // App sync is enabled by default. Register unless explicitly 94 // App sync is enabled by default. Register unless explicitly
92 // disabled. 95 // disabled.
93 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) { 96 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) {
94 pss->RegisterDataTypeController( 97 pss->RegisterDataTypeController(
95 new AppDataTypeController(this, profile_, pss)); 98 new AppDataTypeController(this, profile_, pss));
96 } 99 }
97 100
98 // Autofill sync is enabled by default. Register unless explicitly 101 // Autofill sync is enabled by default. Register unless explicitly
99 // disabled. 102 // disabled.
100 if (!command_line_->HasSwitch(switches::kDisableSyncAutofill)) { 103 if (!command_line_->HasSwitch(switches::kDisableSyncAutofill)) {
101 pss->RegisterDataTypeController( 104 pss->RegisterDataTypeController(
102 new AutofillDataTypeController(this, profile_, pss)); 105 new AutofillDataTypeController(this, profile_));
103 } 106 }
104 107
105 // Bookmark sync is enabled by default. Register unless explicitly 108 // Bookmark sync is enabled by default. Register unless explicitly
106 // disabled. 109 // disabled.
107 if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) { 110 if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) {
108 pss->RegisterDataTypeController( 111 pss->RegisterDataTypeController(
109 new BookmarkDataTypeController(this, profile_, pss)); 112 new BookmarkDataTypeController(this, profile_, pss));
110 } 113 }
111 114
112 // Extension sync is enabled by default. Register unless explicitly 115 // Extension sync is enabled by default. Register unless explicitly
113 // disabled. 116 // disabled.
114 if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) { 117 if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) {
115 pss->RegisterDataTypeController( 118 pss->RegisterDataTypeController(
116 new ExtensionDataTypeController(this, profile_, pss)); 119 new ExtensionDataTypeController(this, profile_, pss));
117 } 120 }
118 121
119 // Password sync is enabled by default. Register unless explicitly 122 // Password sync is enabled by default. Register unless explicitly
120 // disabled. 123 // disabled.
121 if (!command_line_->HasSwitch(switches::kDisableSyncPasswords)) { 124 if (!command_line_->HasSwitch(switches::kDisableSyncPasswords)) {
122 pss->RegisterDataTypeController( 125 pss->RegisterDataTypeController(
123 new PasswordDataTypeController(this, profile_, pss)); 126 new PasswordDataTypeController(this, profile_));
124 } 127 }
125 128
126 // Preference sync is enabled by default. Register unless explicitly 129 // Preference sync is enabled by default. Register unless explicitly
127 // disabled. 130 // disabled.
128 if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { 131 if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) {
129 pss->RegisterDataTypeController( 132 pss->RegisterDataTypeController(
130 new PreferenceDataTypeController(this, profile_, pss)); 133 new PreferenceDataTypeController(this, profile_, pss));
131 } 134 }
132 135
133 // Theme sync is enabled by default. Register unless explicitly disabled. 136 // Theme sync is enabled by default. Register unless explicitly disabled.
134 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) { 137 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) {
135 pss->RegisterDataTypeController( 138 pss->RegisterDataTypeController(
136 new ThemeDataTypeController(this, profile_, pss)); 139 new ThemeDataTypeController(this, profile_, pss));
137 } 140 }
138 141
139 // TypedUrl sync is disabled by default. Register only if 142 // TypedUrl sync is disabled by default. Register only if
140 // explicitly enabled. 143 // explicitly enabled.
141 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) { 144 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) {
142 pss->RegisterDataTypeController( 145 pss->RegisterDataTypeController(
143 new TypedUrlDataTypeController(this, profile_, pss)); 146 new TypedUrlDataTypeController(this, profile_));
144 } 147 }
145 148
146 // Session sync is disabled by default. Register only if explicitly 149 // Session sync is disabled by default. Register only if explicitly
147 // enabled. 150 // enabled.
148 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { 151 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) {
149 pss->RegisterDataTypeController( 152 pss->RegisterDataTypeController(
150 new SessionDataTypeController(this, profile_, pss)); 153 new SessionDataTypeController(this, profile_, pss));
151 } 154 }
152 155
153 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { 156 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) {
154 pss->RegisterDataTypeController(new AutofillProfileDataTypeController( 157 pss->RegisterDataTypeController(
155 this, profile_, pss)); 158 new AutofillProfileDataTypeController(this, profile_));
156 } 159 }
157 return pss;
158 } 160 }
159 161
160 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( 162 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager(
161 SyncBackendHost* backend, 163 SyncBackendHost* backend,
162 const DataTypeController::TypeMap& controllers) { 164 const DataTypeController::TypeMap& controllers) {
163 if (command_line_->HasSwitch(switches::kNewSyncerThread)) 165 if (command_line_->HasSwitch(switches::kNewSyncerThread))
164 return new DataTypeManagerImpl2(backend, controllers); 166 return new DataTypeManagerImpl2(backend, controllers);
165 else 167 else
166 return new DataTypeManagerImpl(backend, controllers); 168 return new DataTypeManagerImpl(backend, controllers);
167 } 169 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ProfileSyncFactory::SyncComponents 307 ProfileSyncFactory::SyncComponents
306 ProfileSyncFactoryImpl::CreateSessionSyncComponents( 308 ProfileSyncFactoryImpl::CreateSessionSyncComponents(
307 ProfileSyncService* profile_sync_service, 309 ProfileSyncService* profile_sync_service,
308 UnrecoverableErrorHandler* error_handler) { 310 UnrecoverableErrorHandler* error_handler) {
309 SessionModelAssociator* model_associator = 311 SessionModelAssociator* model_associator =
310 new SessionModelAssociator(profile_sync_service); 312 new SessionModelAssociator(profile_sync_service);
311 SessionChangeProcessor* change_processor = 313 SessionChangeProcessor* change_processor =
312 new SessionChangeProcessor(error_handler, model_associator); 314 new SessionChangeProcessor(error_handler, model_associator);
313 return SyncComponents(model_associator, change_processor); 315 return SyncComponents(model_associator, change_processor);
314 } 316 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_factory_impl.h ('k') | chrome/browser/sync/profile_sync_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698