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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 // Delete directive sync is enabled by default. Register unless full history | 195 // Delete directive sync is enabled by default. Register unless full history |
196 // sync is disabled. | 196 // sync is disabled. |
197 if (!disabled_types.Has(syncer::HISTORY_DELETE_DIRECTIVES)) { | 197 if (!disabled_types.Has(syncer::HISTORY_DELETE_DIRECTIVES)) { |
198 pss->RegisterDataTypeController( | 198 pss->RegisterDataTypeController( |
199 new UIDataTypeController( | 199 new UIDataTypeController( |
200 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 200 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
201 base::Bind(&ChromeReportUnrecoverableError), | 201 base::Bind(&ChromeReportUnrecoverableError), |
202 syncer::HISTORY_DELETE_DIRECTIVES, | 202 syncer::HISTORY_DELETE_DIRECTIVES, |
203 this, | 203 this, |
204 profile_, | |
205 pss)); | 204 pss)); |
206 } | 205 } |
207 | 206 |
208 // Session sync is enabled by default. Register unless explicitly disabled. | 207 // Session sync is enabled by default. Register unless explicitly disabled. |
209 if (!disabled_types.Has(syncer::PROXY_TABS)) { | 208 if (!disabled_types.Has(syncer::PROXY_TABS)) { |
210 pss->RegisterDataTypeController(new ProxyDataTypeController( | 209 pss->RegisterDataTypeController(new ProxyDataTypeController( |
211 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 210 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
212 syncer::PROXY_TABS)); | 211 syncer::PROXY_TABS)); |
213 pss->RegisterDataTypeController( | 212 pss->RegisterDataTypeController( |
214 new SessionDataTypeController(this, profile_, pss)); | 213 new SessionDataTypeController(this, profile_, pss)); |
215 } | 214 } |
216 | 215 |
217 // Favicon sync is enabled by default. Register unless explicitly disabled. | 216 // Favicon sync is enabled by default. Register unless explicitly disabled. |
218 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && | 217 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && |
219 !disabled_types.Has(syncer::FAVICON_TRACKING)) { | 218 !disabled_types.Has(syncer::FAVICON_TRACKING)) { |
220 pss->RegisterDataTypeController( | 219 pss->RegisterDataTypeController( |
221 new UIDataTypeController( | 220 new UIDataTypeController( |
222 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 221 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
223 base::Bind(&ChromeReportUnrecoverableError), | 222 base::Bind(&ChromeReportUnrecoverableError), |
224 syncer::FAVICON_IMAGES, | 223 syncer::FAVICON_IMAGES, |
225 this, | 224 this, |
226 profile_, | |
227 pss)); | 225 pss)); |
228 pss->RegisterDataTypeController( | 226 pss->RegisterDataTypeController( |
229 new UIDataTypeController( | 227 new UIDataTypeController( |
230 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 228 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
231 base::Bind(&ChromeReportUnrecoverableError), | 229 base::Bind(&ChromeReportUnrecoverableError), |
232 syncer::FAVICON_TRACKING, | 230 syncer::FAVICON_TRACKING, |
233 this, | 231 this, |
234 profile_, | |
235 pss)); | 232 pss)); |
236 } | 233 } |
237 | 234 |
238 // Password sync is enabled by default. Register unless explicitly | 235 // Password sync is enabled by default. Register unless explicitly |
239 // disabled. | 236 // disabled. |
240 if (!disabled_types.Has(syncer::PASSWORDS)) { | 237 if (!disabled_types.Has(syncer::PASSWORDS)) { |
241 pss->RegisterDataTypeController( | 238 pss->RegisterDataTypeController( |
242 new PasswordDataTypeController(this, profile_, pss)); | 239 new PasswordDataTypeController(this, profile_, pss)); |
243 } | 240 } |
244 | 241 |
245 // Article sync is disabled by default. Register only if explicitly enabled. | 242 // Article sync is disabled by default. Register only if explicitly enabled. |
246 if (IsEnableSyncArticlesSet()) { | 243 if (IsEnableSyncArticlesSet()) { |
247 pss->RegisterDataTypeController( | 244 pss->RegisterDataTypeController( |
248 new UIDataTypeController( | 245 new UIDataTypeController( |
249 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 246 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
250 base::Bind(&ChromeReportUnrecoverableError), | 247 base::Bind(&ChromeReportUnrecoverableError), |
251 syncer::ARTICLES, | 248 syncer::ARTICLES, |
252 this, | 249 this, |
253 profile_, | |
254 pss)); | 250 pss)); |
255 } | 251 } |
256 | 252 |
257 #if defined(ENABLE_MANAGED_USERS) | 253 #if defined(ENABLE_MANAGED_USERS) |
258 if (profile_->IsManaged()) { | 254 if (profile_->IsManaged()) { |
259 pss->RegisterDataTypeController( | 255 pss->RegisterDataTypeController( |
260 new UIDataTypeController( | 256 new UIDataTypeController( |
261 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 257 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
262 base::Bind(&ChromeReportUnrecoverableError), | 258 base::Bind(&ChromeReportUnrecoverableError), |
263 syncer::MANAGED_USER_SETTINGS, | 259 syncer::MANAGED_USER_SETTINGS, |
264 this, | 260 this, |
265 profile_, | |
266 pss)); | 261 pss)); |
267 } else { | 262 } else { |
268 pss->RegisterDataTypeController( | 263 pss->RegisterDataTypeController( |
269 new UIDataTypeController( | 264 new UIDataTypeController( |
270 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 265 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
271 base::Bind(&ChromeReportUnrecoverableError), | 266 base::Bind(&ChromeReportUnrecoverableError), |
272 syncer::MANAGED_USERS, | 267 syncer::MANAGED_USERS, |
273 this, | 268 this, |
274 profile_, | |
275 pss)); | 269 pss)); |
276 } | 270 } |
277 pss->RegisterDataTypeController( | 271 pss->RegisterDataTypeController( |
278 new UIDataTypeController( | 272 new UIDataTypeController( |
279 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 273 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
280 base::Bind(&ChromeReportUnrecoverableError), | 274 base::Bind(&ChromeReportUnrecoverableError), |
281 syncer::MANAGED_USER_SHARED_SETTINGS, | 275 syncer::MANAGED_USER_SHARED_SETTINGS, |
282 this, | 276 this, |
283 profile_, | |
284 pss)); | 277 pss)); |
285 #endif | 278 #endif |
286 } | 279 } |
287 | 280 |
288 void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( | 281 void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( |
289 syncer::ModelTypeSet disabled_types, | 282 syncer::ModelTypeSet disabled_types, |
290 ProfileSyncService* pss) { | 283 ProfileSyncService* pss) { |
291 // App sync is enabled by default. Register unless explicitly | 284 // App sync is enabled by default. Register unless explicitly |
292 // disabled. | 285 // disabled. |
293 if (!disabled_types.Has(syncer::APPS)) { | 286 if (!disabled_types.Has(syncer::APPS)) { |
(...skipping 11 matching lines...) Expand all Loading... |
305 | 298 |
306 // Preference sync is enabled by default. Register unless explicitly | 299 // Preference sync is enabled by default. Register unless explicitly |
307 // disabled. | 300 // disabled. |
308 if (!disabled_types.Has(syncer::PREFERENCES)) { | 301 if (!disabled_types.Has(syncer::PREFERENCES)) { |
309 pss->RegisterDataTypeController( | 302 pss->RegisterDataTypeController( |
310 new UIDataTypeController( | 303 new UIDataTypeController( |
311 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 304 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
312 base::Bind(&ChromeReportUnrecoverableError), | 305 base::Bind(&ChromeReportUnrecoverableError), |
313 syncer::PREFERENCES, | 306 syncer::PREFERENCES, |
314 this, | 307 this, |
315 profile_, | |
316 pss)); | 308 pss)); |
317 | 309 |
318 } | 310 } |
319 | 311 |
320 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { | 312 if (!disabled_types.Has(syncer::PRIORITY_PREFERENCES)) { |
321 pss->RegisterDataTypeController( | 313 pss->RegisterDataTypeController( |
322 new UIDataTypeController( | 314 new UIDataTypeController( |
323 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 315 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
324 base::Bind(&ChromeReportUnrecoverableError), | 316 base::Bind(&ChromeReportUnrecoverableError), |
325 syncer::PRIORITY_PREFERENCES, | 317 syncer::PRIORITY_PREFERENCES, |
326 this, | 318 this, |
327 profile_, | |
328 pss)); | 319 pss)); |
329 } | 320 } |
330 | 321 |
331 #if defined(ENABLE_THEMES) | 322 #if defined(ENABLE_THEMES) |
332 // Theme sync is enabled by default. Register unless explicitly disabled. | 323 // Theme sync is enabled by default. Register unless explicitly disabled. |
333 if (!disabled_types.Has(syncer::THEMES)) { | 324 if (!disabled_types.Has(syncer::THEMES)) { |
334 pss->RegisterDataTypeController( | 325 pss->RegisterDataTypeController( |
335 new ThemeDataTypeController(this, profile_, pss)); | 326 new ThemeDataTypeController(this, profile_, pss)); |
336 } | 327 } |
337 #endif | 328 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
360 } | 351 } |
361 | 352 |
362 #if defined(ENABLE_APP_LIST) | 353 #if defined(ENABLE_APP_LIST) |
363 if (app_list::switches::IsAppListSyncEnabled()) { | 354 if (app_list::switches::IsAppListSyncEnabled()) { |
364 pss->RegisterDataTypeController( | 355 pss->RegisterDataTypeController( |
365 new UIDataTypeController( | 356 new UIDataTypeController( |
366 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 357 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
367 base::Bind(&ChromeReportUnrecoverableError), | 358 base::Bind(&ChromeReportUnrecoverableError), |
368 syncer::APP_LIST, | 359 syncer::APP_LIST, |
369 this, | 360 this, |
370 profile_, | |
371 pss)); | 361 pss)); |
372 } | 362 } |
373 #endif | 363 #endif |
374 | 364 |
375 // Synced Notifications are enabled by default. | 365 // Synced Notifications are enabled by default. |
376 if (!disabled_types.Has(syncer::SYNCED_NOTIFICATIONS)) { | 366 if (!disabled_types.Has(syncer::SYNCED_NOTIFICATIONS)) { |
377 pss->RegisterDataTypeController( | 367 pss->RegisterDataTypeController( |
378 new UIDataTypeController( | 368 new UIDataTypeController( |
379 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 369 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
380 base::Bind(&ChromeReportUnrecoverableError), | 370 base::Bind(&ChromeReportUnrecoverableError), |
381 syncer::SYNCED_NOTIFICATIONS, | 371 syncer::SYNCED_NOTIFICATIONS, |
382 this, | 372 this, |
383 profile_, | |
384 pss)); | 373 pss)); |
385 | 374 |
386 // Synced Notification App Infos are enabled by default on Dev and Canary | 375 // Synced Notification App Infos are enabled by default on Dev and Canary |
387 // only. | 376 // only. |
388 // TODO(petewil): Enable on stable when the feature is ready. | 377 // TODO(petewil): Enable on stable when the feature is ready. |
389 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 378 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
390 if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN || | 379 if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN || |
391 channel == chrome::VersionInfo::CHANNEL_DEV || | 380 channel == chrome::VersionInfo::CHANNEL_DEV || |
392 channel == chrome::VersionInfo::CHANNEL_CANARY) { | 381 channel == chrome::VersionInfo::CHANNEL_CANARY) { |
393 pss->RegisterDataTypeController(new UIDataTypeController( | 382 pss->RegisterDataTypeController(new UIDataTypeController( |
394 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 383 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
395 base::Bind(&ChromeReportUnrecoverableError), | 384 base::Bind(&ChromeReportUnrecoverableError), |
396 syncer::SYNCED_NOTIFICATION_APP_INFO, | 385 syncer::SYNCED_NOTIFICATION_APP_INFO, |
397 this, | 386 this, |
398 profile_, | |
399 pss)); | 387 pss)); |
400 } | 388 } |
401 } | 389 } |
402 | 390 |
403 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 391 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
404 // Dictionary sync is enabled by default. | 392 // Dictionary sync is enabled by default. |
405 if (!disabled_types.Has(syncer::DICTIONARY)) { | 393 if (!disabled_types.Has(syncer::DICTIONARY)) { |
406 pss->RegisterDataTypeController( | 394 pss->RegisterDataTypeController( |
407 new UIDataTypeController( | 395 new UIDataTypeController( |
408 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 396 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
409 base::Bind(&ChromeReportUnrecoverableError), | 397 base::Bind(&ChromeReportUnrecoverableError), |
410 syncer::DICTIONARY, | 398 syncer::DICTIONARY, |
411 this, | 399 this, |
412 profile_, | |
413 pss)); | 400 pss)); |
414 } | 401 } |
415 #endif | 402 #endif |
416 } | 403 } |
417 | 404 |
418 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( | 405 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( |
419 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 406 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
420 debug_info_listener, | 407 debug_info_listener, |
421 const DataTypeController::TypeMap* controllers, | 408 const DataTypeController::TypeMap* controllers, |
422 const browser_sync::DataTypeEncryptionHandler* encryption_handler, | 409 const browser_sync::DataTypeEncryptionHandler* encryption_handler, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 new TypedUrlModelAssociator(profile_sync_service, | 614 new TypedUrlModelAssociator(profile_sync_service, |
628 history_backend, | 615 history_backend, |
629 error_handler); | 616 error_handler); |
630 TypedUrlChangeProcessor* change_processor = | 617 TypedUrlChangeProcessor* change_processor = |
631 new TypedUrlChangeProcessor(profile_, | 618 new TypedUrlChangeProcessor(profile_, |
632 model_associator, | 619 model_associator, |
633 history_backend, | 620 history_backend, |
634 error_handler); | 621 error_handler); |
635 return SyncComponents(model_associator, change_processor); | 622 return SyncComponents(model_associator, change_processor); |
636 } | 623 } |
OLD | NEW |