blob: c3f09d32e5b09f3e7eb1cffd3511d804339636d4 [file] [log] [blame]
[email protected]ceffdf02012-07-17 20:12:151// 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]8597ccf2014-05-15 03:49:277#include "sync/internal_api/sync_backup_manager.h"
[email protected]ceffdf02012-07-17 20:12:158#include "sync/internal_api/sync_manager_impl.h"
[email protected]8597ccf2014-05-15 03:49:279#include "sync/internal_api/sync_rollback_manager.h"
[email protected]ceffdf02012-07-17 20:12:1510
11namespace syncer {
12
[email protected]8597ccf2014-05-15 03:49:2713SyncManagerFactory::SyncManagerFactory(SyncManagerFactory::MANAGER_TYPE type)
14 : type_(type) {
[email protected]ceffdf02012-07-17 20:12:1515}
16
17SyncManagerFactory::~SyncManagerFactory() {
18}
19
20scoped_ptr<SyncManager> SyncManagerFactory::CreateSyncManager(
21 const std::string name) {
[email protected]8597ccf2014-05-15 03:49:2722 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]ceffdf02012-07-17 20:12:1533}
34
35} // namespace syncer