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

Side by Side Diff: sync/internal_api/sync_manager_factory.cc

Issue 265823009: Let SyncManagerFactory create different types of sync managers according to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "sync/internal_api/public/sync_manager_factory.h" 5 #include "sync/internal_api/public/sync_manager_factory.h"
6 6
7 #include "sync/internal_api/sync_backup_manager.h"
7 #include "sync/internal_api/sync_manager_impl.h" 8 #include "sync/internal_api/sync_manager_impl.h"
9 #include "sync/internal_api/sync_rollback_manager.h"
8 10
9 namespace syncer { 11 namespace syncer {
10 12
11 SyncManagerFactory::SyncManagerFactory() { 13 SyncManagerFactory::SyncManagerFactory(SyncManagerFactory::MANAGER_TYPE type)
14 : type_(type) {
12 } 15 }
13 16
14 SyncManagerFactory::~SyncManagerFactory() { 17 SyncManagerFactory::~SyncManagerFactory() {
15 } 18 }
16 19
17 scoped_ptr<SyncManager> SyncManagerFactory::CreateSyncManager( 20 scoped_ptr<SyncManager> SyncManagerFactory::CreateSyncManager(
18 const std::string name) { 21 const std::string name) {
19 return scoped_ptr<SyncManager>(new SyncManagerImpl(name)); 22 switch (type_) {
23 case NORMAL:
24 return scoped_ptr<SyncManager>(new SyncManagerImpl(name));
25 case BACKUP:
26 return scoped_ptr<SyncManager>(new SyncBackupManager);
Nicolas Zea 2014/05/13 17:49:15 nit: prefer explicitly noting that this is being d
haitaol1 2014/05/13 18:10:59 Done.
27 case ROLLBACK:
28 return scoped_ptr<SyncManager>(new SyncRollbackManager);
29 default:
30 NOTREACHED();
31 }
20 } 32 }
21 33
22 } // namespace syncer 34 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698