OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/sync/chrome_sync_client.h" | 5 #include "chrome/browser/sync/chrome_sync_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); | 449 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); |
450 case syncer::AUTOFILL: | 450 case syncer::AUTOFILL: |
451 return autofill::AutocompleteSyncBridge::FromWebDataService( | 451 return autofill::AutocompleteSyncBridge::FromWebDataService( |
452 web_data_service_.get()); | 452 web_data_service_.get()); |
453 #if defined(OS_CHROMEOS) | 453 #if defined(OS_CHROMEOS) |
454 case syncer::PRINTERS: | 454 case syncer::PRINTERS: |
455 return chromeos::PrintersManagerFactory::GetForBrowserContext(profile_) | 455 return chromeos::PrintersManagerFactory::GetForBrowserContext(profile_) |
456 ->GetSyncBridge() | 456 ->GetSyncBridge() |
457 ->AsWeakPtr(); | 457 ->AsWeakPtr(); |
458 #endif | 458 #endif |
459 case syncer::TYPED_URLS: { | |
460 // We request history service with explicit access here because this | |
461 // codepath is executed on backend thread while HistoryServiceFactory | |
skym
2017/03/03 17:41:09
I'm not sure I agree with you that the way the cod
Gang Wu
2017/03/06 08:21:23
Done.
| |
462 // checks preference value in implicit mode and PrefService expectes calls | |
463 // only from UI thread. | |
464 history::HistoryService* history = HistoryServiceFactory::GetForProfile( | |
465 profile_, ServiceAccessType::EXPLICIT_ACCESS); | |
466 if (!history) | |
467 return base::WeakPtr<history::TypedURLSyncBridge>(); | |
468 return history->GetTypedURLSyncBridge()->AsWeakPtr(); | |
469 } | |
459 default: | 470 default: |
460 NOTREACHED(); | 471 NOTREACHED(); |
461 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); | 472 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); |
462 } | 473 } |
463 } | 474 } |
464 | 475 |
465 scoped_refptr<syncer::ModelSafeWorker> | 476 scoped_refptr<syncer::ModelSafeWorker> |
466 ChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { | 477 ChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { |
467 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 478 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
468 switch (group) { | 479 switch (group) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 sync_service->RegisterDataTypeController( | 663 sync_service->RegisterDataTypeController( |
653 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 664 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
654 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); | 665 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); |
655 sync_service->RegisterDataTypeController( | 666 sync_service->RegisterDataTypeController( |
656 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 667 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
657 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); | 668 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); |
658 #endif | 669 #endif |
659 } | 670 } |
660 | 671 |
661 } // namespace browser_sync | 672 } // namespace browser_sync |
OLD | NEW |