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

Side by Side Diff: ios/chrome/browser/sync/fake_sync_service_factory.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 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 "ios/chrome/browser/sync/fake_sync_service_factory.h" 5 #include "ios/chrome/browser/sync/fake_sync_service_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/core/keyed_service.h" 10 #include "components/keyed_service/core/keyed_service.h"
11 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 11 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
12 #include "components/sync/driver/fake_sync_service.h" 12 #include "components/sync/driver/fake_sync_service.h"
13 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 13 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
14 14
15 namespace { 15 namespace {
16 16
17 class KeyedFakeSyncService : public KeyedService { 17 class KeyedFakeSyncService : public KeyedService {
18 public: 18 public:
19 KeyedFakeSyncService() {} 19 KeyedFakeSyncService() {}
20 20
21 sync_driver::FakeSyncService* fake_sync_service() { 21 syncer::FakeSyncService* fake_sync_service() { return &fake_sync_service_; }
22 return &fake_sync_service_;
23 }
24 22
25 private: 23 private:
26 sync_driver::FakeSyncService fake_sync_service_; 24 syncer::FakeSyncService fake_sync_service_;
27 }; 25 };
28 26
29 } // namespace 27 } // namespace
30 28
31 namespace ios { 29 namespace ios {
32 30
33 // static 31 // static
34 FakeSyncServiceFactory* FakeSyncServiceFactory::GetInstance() { 32 FakeSyncServiceFactory* FakeSyncServiceFactory::GetInstance() {
35 return base::Singleton<FakeSyncServiceFactory>::get(); 33 return base::Singleton<FakeSyncServiceFactory>::get();
36 } 34 }
37 35
38 // static 36 // static
39 sync_driver::FakeSyncService* FakeSyncServiceFactory::GetForBrowserState( 37 syncer::FakeSyncService* FakeSyncServiceFactory::GetForBrowserState(
40 ios::ChromeBrowserState* browser_state) { 38 ios::ChromeBrowserState* browser_state) {
41 return static_cast<KeyedFakeSyncService*>( 39 return static_cast<KeyedFakeSyncService*>(
42 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState( 40 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState(
43 browser_state, true)) 41 browser_state, true))
44 ->fake_sync_service(); 42 ->fake_sync_service();
45 } 43 }
46 44
47 // static 45 // static
48 sync_driver::FakeSyncService* 46 syncer::FakeSyncService* FakeSyncServiceFactory::GetForBrowserStateIfExists(
49 FakeSyncServiceFactory::GetForBrowserStateIfExists(
50 ios::ChromeBrowserState* browser_state) { 47 ios::ChromeBrowserState* browser_state) {
51 return static_cast<KeyedFakeSyncService*>( 48 return static_cast<KeyedFakeSyncService*>(
52 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState( 49 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState(
53 browser_state, false)) 50 browser_state, false))
54 ->fake_sync_service(); 51 ->fake_sync_service();
55 } 52 }
56 53
57 FakeSyncServiceFactory::FakeSyncServiceFactory() 54 FakeSyncServiceFactory::FakeSyncServiceFactory()
58 : BrowserStateKeyedServiceFactory( 55 : BrowserStateKeyedServiceFactory(
59 "FakeSyncService", 56 "FakeSyncService",
60 BrowserStateDependencyManager::GetInstance()) {} 57 BrowserStateDependencyManager::GetInstance()) {}
61 58
62 FakeSyncServiceFactory::~FakeSyncServiceFactory() {} 59 FakeSyncServiceFactory::~FakeSyncServiceFactory() {}
63 60
64 std::unique_ptr<KeyedService> FakeSyncServiceFactory::BuildServiceInstanceFor( 61 std::unique_ptr<KeyedService> FakeSyncServiceFactory::BuildServiceInstanceFor(
65 web::BrowserState* context) const { 62 web::BrowserState* context) const {
66 return base::WrapUnique(new KeyedFakeSyncService); 63 return base::WrapUnique(new KeyedFakeSyncService);
67 } 64 }
68 65
69 } // namespace ios 66 } // namespace ios
OLDNEW
« no previous file with comments | « ios/chrome/browser/sync/fake_sync_service_factory.h ('k') | ios/chrome/browser/sync/glue/sync_start_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698