1 // Copyright 2014 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.
5 #include "chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/drive/service/drive_service_interface.h"
12 namespace sync_file_system
{
13 namespace drive_backend
{
15 DriveServiceWrapper::DriveServiceWrapper(
16 drive::DriveServiceInterface
* drive_service
)
17 : drive_service_(drive_service
) {
18 DCHECK(drive_service_
);
21 void DriveServiceWrapper::AddNewDirectory(
22 const std::string
& parent_resource_id
,
23 const std::string
& directory_title
,
24 const drive::AddNewDirectoryOptions
& options
,
25 const google_apis::FileResourceCallback
& callback
) {
26 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
27 drive_service_
->AddNewDirectory(parent_resource_id
,
33 void DriveServiceWrapper::DeleteResource(
34 const std::string
& resource_id
,
35 const std::string
& etag
,
36 const google_apis::EntryActionCallback
& callback
) {
37 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
38 drive_service_
->DeleteResource(resource_id
,
43 void DriveServiceWrapper::DownloadFile(
44 const base::FilePath
& local_cache_path
,
45 const std::string
& resource_id
,
46 const google_apis::DownloadActionCallback
& download_action_callback
,
47 const google_apis::GetContentCallback
& get_content_callback
,
48 const google_apis::ProgressCallback
& progress_callback
) {
49 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
50 drive_service_
->DownloadFile(local_cache_path
,
52 download_action_callback
,
57 void DriveServiceWrapper::GetAboutResource(
58 const google_apis::AboutResourceCallback
& callback
) {
59 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
60 drive_service_
->GetAboutResource(callback
);
63 void DriveServiceWrapper::GetChangeList(
64 int64 start_changestamp
,
65 const google_apis::ChangeListCallback
& callback
) {
66 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
67 drive_service_
->GetChangeList(start_changestamp
, callback
);
70 void DriveServiceWrapper::GetRemainingChangeList(
71 const GURL
& next_link
,
72 const google_apis::ChangeListCallback
& callback
) {
73 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
74 drive_service_
->GetRemainingChangeList(next_link
, callback
);
77 void DriveServiceWrapper::GetRemainingFileList(
78 const GURL
& next_link
,
79 const google_apis::FileListCallback
& callback
) {
80 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
81 drive_service_
->GetRemainingFileList(next_link
, callback
);
84 void DriveServiceWrapper::GetFileResource(
85 const std::string
& resource_id
,
86 const google_apis::FileResourceCallback
& callback
) {
87 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
88 drive_service_
->GetFileResource(resource_id
, callback
);
91 void DriveServiceWrapper::GetFileListInDirectory(
92 const std::string
& directory_resource_id
,
93 const google_apis::FileListCallback
& callback
) {
94 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
95 drive_service_
->GetFileListInDirectory(directory_resource_id
, callback
);
98 void DriveServiceWrapper::RemoveResourceFromDirectory(
99 const std::string
& parent_resource_id
,
100 const std::string
& resource_id
,
101 const google_apis::EntryActionCallback
& callback
) {
102 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
103 drive_service_
->RemoveResourceFromDirectory(
104 parent_resource_id
, resource_id
, callback
);
107 void DriveServiceWrapper::SearchByTitle(
108 const std::string
& title
,
109 const std::string
& directory_resource_id
,
110 const google_apis::FileListCallback
& callback
) {
111 DCHECK(sequece_checker_
.CalledOnValidSequencedThread());
112 drive_service_
->SearchByTitle(
113 title
, directory_resource_id
, callback
);
116 } // namespace drive_backend
117 } // namespace sync_file_system