| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/user_event_service_factory.h" | 5 #include "chrome/browser/sync/user_event_service_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 Profile* profile = Profile::FromBrowserContext(context); | 50 Profile* profile = Profile::FromBrowserContext(context); |
| 51 syncer::ModelTypeStoreFactory store_factory = | 51 syncer::ModelTypeStoreFactory store_factory = |
| 52 browser_sync::ProfileSyncService::GetModelTypeStoreFactory( | 52 browser_sync::ProfileSyncService::GetModelTypeStoreFactory( |
| 53 syncer::USER_EVENTS, profile->GetPath()); | 53 syncer::USER_EVENTS, profile->GetPath()); |
| 54 syncer::ModelTypeSyncBridge::ChangeProcessorFactory processor_factory = | 54 syncer::ModelTypeSyncBridge::ChangeProcessorFactory processor_factory = |
| 55 base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create, | 55 base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create, |
| 56 base::BindRepeating(&syncer::ReportUnrecoverableError, | 56 base::BindRepeating(&syncer::ReportUnrecoverableError, |
| 57 chrome::GetChannel())); | 57 chrome::GetChannel())); |
| 58 syncer::SyncService* sync_service = |
| 59 ProfileSyncServiceFactory::GetForProfile(profile); |
| 58 auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>( | 60 auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>( |
| 59 std::move(store_factory), std::move(processor_factory)); | 61 std::move(store_factory), std::move(processor_factory), |
| 60 return new syncer::UserEventServiceImpl( | 62 sync_service->GetGlobalIdMapper()); |
| 61 ProfileSyncServiceFactory::GetForProfile(profile), std::move(bridge)); | 63 return new syncer::UserEventServiceImpl(sync_service, std::move(bridge)); |
| 62 } | 64 } |
| 63 | 65 |
| 64 content::BrowserContext* UserEventServiceFactory::GetBrowserContextToUse( | 66 content::BrowserContext* UserEventServiceFactory::GetBrowserContextToUse( |
| 65 content::BrowserContext* context) const { | 67 content::BrowserContext* context) const { |
| 66 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 68 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace browser_sync | 71 } // namespace browser_sync |
| OLD | NEW |