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

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

Issue 2909283003: [Sync] Split UserEventService into interface and impl, add fake impl, add unit tests. (Closed)
Patch Set: Self review. Created 3 years, 6 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
OLDNEW
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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/sync/profile_sync_service_factory.h" 12 #include "chrome/browser/sync/profile_sync_service_factory.h"
13 #include "chrome/common/channel_info.h" 13 #include "chrome/common/channel_info.h"
14 #include "components/browser_sync/profile_sync_service.h" 14 #include "components/browser_sync/profile_sync_service.h"
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" 15 #include "components/keyed_service/content/browser_context_dependency_manager.h"
16 #include "components/sync/base/model_type.h" 16 #include "components/sync/base/model_type.h"
17 #include "components/sync/base/report_unrecoverable_error.h" 17 #include "components/sync/base/report_unrecoverable_error.h"
18 #include "components/sync/user_events/user_event_service.h" 18 #include "components/sync/user_events/user_event_service_impl.h"
19 #include "components/sync/user_events/user_event_sync_bridge.h" 19 #include "components/sync/user_events/user_event_sync_bridge.h"
20 20
21 namespace browser_sync { 21 namespace browser_sync {
22 22
23 // static 23 // static
24 UserEventServiceFactory* UserEventServiceFactory::GetInstance() { 24 UserEventServiceFactory* UserEventServiceFactory::GetInstance() {
25 return base::Singleton<UserEventServiceFactory>::get(); 25 return base::Singleton<UserEventServiceFactory>::get();
26 } 26 }
27 27
28 // static 28 // static
(...skipping 15 matching lines...) Expand all
44 Profile* profile = Profile::FromBrowserContext(context); 44 Profile* profile = Profile::FromBrowserContext(context);
45 syncer::ModelTypeStoreFactory store_factory = 45 syncer::ModelTypeStoreFactory store_factory =
46 browser_sync::ProfileSyncService::GetModelTypeStoreFactory( 46 browser_sync::ProfileSyncService::GetModelTypeStoreFactory(
47 syncer::USER_EVENTS, profile->GetPath()); 47 syncer::USER_EVENTS, profile->GetPath());
48 syncer::ModelTypeSyncBridge::ChangeProcessorFactory processor_factory = 48 syncer::ModelTypeSyncBridge::ChangeProcessorFactory processor_factory =
49 base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create, 49 base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create,
50 base::BindRepeating(&syncer::ReportUnrecoverableError, 50 base::BindRepeating(&syncer::ReportUnrecoverableError,
51 chrome::GetChannel())); 51 chrome::GetChannel()));
52 auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>( 52 auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>(
53 std::move(store_factory), std::move(processor_factory)); 53 std::move(store_factory), std::move(processor_factory));
54 return new syncer::UserEventService( 54 return new syncer::UserEventServiceImpl(
55 ProfileSyncServiceFactory::GetForProfile(profile), std::move(bridge)); 55 ProfileSyncServiceFactory::GetForProfile(profile), std::move(bridge));
56 } 56 }
57 57
58 } // namespace browser_sync 58 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698