summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync_file_system/remote_file_sync_service.cc
blob: 522146c100081e4486beda18de63bec1bc1977b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/sync_file_system/remote_file_sync_service.h"

#include "chrome/browser/sync_file_system/drive_backend/sync_engine.h"
#include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service.h"

namespace sync_file_system {

scoped_ptr<RemoteFileSyncService>
RemoteFileSyncService::CreateForBrowserContext(
    BackendVersion version,
    content::BrowserContext* context) {
  switch (version) {
    case V1:
      return DriveFileSyncService::Create(
          Profile::FromBrowserContext(context)).PassAs<RemoteFileSyncService>();
    case V2:
      return drive_backend::SyncEngine::CreateForBrowserContext(
          context).PassAs<RemoteFileSyncService>();
  }
  NOTREACHED() << "Unknown version " << version;
  return scoped_ptr<RemoteFileSyncService>();
}

void RemoteFileSyncService::AppendDependsOnFactories(
    BackendVersion version,
    std::set<BrowserContextKeyedServiceFactory*>* factories) {
  switch (version) {
    case V1:
      DriveFileSyncService::AppendDependsOnFactories(factories);
      return;
    case V2:
      drive_backend::SyncEngine::AppendDependsOnFactories(factories);
      return;
  }
  NOTREACHED() << "Unknown version " << version;
}

}  // namespace sync_file_system