[email protected] | ceffdf0 | 2012-07-17 20:12:15 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "sync/internal_api/public/sync_manager_factory.h" | ||||
6 | |||||
[email protected] | 8597ccf | 2014-05-15 03:49:27 | [diff] [blame] | 7 | #include "sync/internal_api/sync_backup_manager.h" |
[email protected] | ceffdf0 | 2012-07-17 20:12:15 | [diff] [blame] | 8 | #include "sync/internal_api/sync_manager_impl.h" |
[email protected] | 8597ccf | 2014-05-15 03:49:27 | [diff] [blame] | 9 | #include "sync/internal_api/sync_rollback_manager.h" |
[email protected] | ceffdf0 | 2012-07-17 20:12:15 | [diff] [blame] | 10 | |
11 | namespace syncer { | ||||
12 | |||||
[email protected] | 8597ccf | 2014-05-15 03:49:27 | [diff] [blame] | 13 | SyncManagerFactory::SyncManagerFactory(SyncManagerFactory::MANAGER_TYPE type) |
14 | : type_(type) { | ||||
[email protected] | ceffdf0 | 2012-07-17 20:12:15 | [diff] [blame] | 15 | } |
16 | |||||
17 | SyncManagerFactory::~SyncManagerFactory() { | ||||
18 | } | ||||
19 | |||||
20 | scoped_ptr<SyncManager> SyncManagerFactory::CreateSyncManager( | ||||
21 | const std::string name) { | ||||
[email protected] | 8597ccf | 2014-05-15 03:49:27 | [diff] [blame] | 22 | switch (type_) { |
23 | case NORMAL: | ||||
24 | return scoped_ptr<SyncManager>(new SyncManagerImpl(name)); | ||||
25 | case BACKUP: | ||||
26 | return scoped_ptr<SyncManager>(new SyncBackupManager()); | ||||
27 | case ROLLBACK: | ||||
28 | return scoped_ptr<SyncManager>(new SyncRollbackManager()); | ||||
29 | default: | ||||
30 | NOTREACHED(); | ||||
31 | return scoped_ptr<SyncManager>(new SyncManagerImpl(name)); | ||||
32 | } | ||||
[email protected] | ceffdf0 | 2012-07-17 20:12:15 | [diff] [blame] | 33 | } |
34 | |||||
35 | } // namespace syncer |