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 "chrome/browser/drive/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::DriveServiceInterface::AddNewDirectoryOptions& options,
25 const google_apis::GetResourceEntryCallback& callback) {
26 drive_service_->AddNewDirectory(parent_resource_id,
32 void DriveServiceWrapper::DeleteResource(
33 const std::string& resource_id,
34 const std::string& etag,
35 const google_apis::EntryActionCallback& callback) {
36 drive_service_->DeleteResource(resource_id,
41 void DriveServiceWrapper::DownloadFile(
42 const base::FilePath& local_cache_path,
43 const std::string& resource_id,
44 const google_apis::DownloadActionCallback& download_action_callback,
45 const google_apis::GetContentCallback& get_content_callback,
46 const google_apis::ProgressCallback& progress_callback) {
47 drive_service_->DownloadFile(local_cache_path,
49 download_action_callback,
54 void DriveServiceWrapper::GetAboutResource(
55 const google_apis::AboutResourceCallback& callback) {
56 drive_service_->GetAboutResource(callback);
59 void DriveServiceWrapper::GetChangeList(
60 int64 start_changestamp,
61 const google_apis::GetResourceListCallback& callback) {
62 drive_service_->GetChangeList(start_changestamp, callback);
65 void DriveServiceWrapper::GetRemainingChangeList(
66 const GURL& next_link,
67 const google_apis::GetResourceListCallback& callback) {
68 drive_service_->GetRemainingChangeList(next_link, callback);
71 void DriveServiceWrapper::GetRemainingFileList(
72 const GURL& next_link,
73 const google_apis::GetResourceListCallback& callback) {
74 drive_service_->GetRemainingFileList(next_link, callback);
77 void DriveServiceWrapper::GetResourceEntry(
78 const std::string& resource_id,
79 const google_apis::GetResourceEntryCallback& callback) {
80 drive_service_->GetResourceEntry(resource_id, callback);
83 void DriveServiceWrapper::GetResourceListInDirectory(
84 const std::string& directory_resource_id,
85 const google_apis::GetResourceListCallback& callback) {
86 drive_service_->GetResourceListInDirectory(directory_resource_id,
90 bool DriveServiceWrapper::HasRefreshToken() const {
91 return drive_service_->HasRefreshToken();
94 void DriveServiceWrapper::RemoveResourceFromDirectory(
95 const std::string& parent_resource_id,
96 const std::string& resource_id,
97 const google_apis::EntryActionCallback& callback) {
98 drive_service_->RemoveResourceFromDirectory(
99 parent_resource_id, resource_id, callback);
102 void DriveServiceWrapper::SearchByTitle(
103 const std::string& title,
104 const std::string& directory_resource_id,
105 const google_apis::GetResourceListCallback& callback) {
106 drive_service_->SearchByTitle(
107 title, directory_resource_id, callback);
110 } // namespace drive_backend
111 } // namespace sync_file_system