drive_service_wrapper.cc revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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. 4 5#include "chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h" 6 7#include <string> 8 9#include "base/memory/weak_ptr.h" 10#include "chrome/browser/drive/drive_service_interface.h" 11 12namespace sync_file_system { 13namespace drive_backend { 14 15DriveServiceWrapper::DriveServiceWrapper( 16 drive::DriveServiceInterface* drive_service) 17 : drive_service_(drive_service) { 18 DCHECK(drive_service_); 19} 20 21void 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, 27 directory_title, 28 options, 29 callback); 30} 31 32void 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, 37 etag, 38 callback); 39} 40 41void 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, 48 resource_id, 49 download_action_callback, 50 get_content_callback, 51 progress_callback); 52} 53 54void DriveServiceWrapper::GetAboutResource( 55 const google_apis::AboutResourceCallback& callback) { 56 drive_service_->GetAboutResource(callback); 57} 58 59void DriveServiceWrapper::GetChangeList( 60 int64 start_changestamp, 61 const google_apis::ChangeListCallback& callback) { 62 drive_service_->GetChangeList(start_changestamp, callback); 63} 64 65void DriveServiceWrapper::GetRemainingChangeList( 66 const GURL& next_link, 67 const google_apis::ChangeListCallback& callback) { 68 drive_service_->GetRemainingChangeList(next_link, callback); 69} 70 71void DriveServiceWrapper::GetRemainingFileList( 72 const GURL& next_link, 73 const google_apis::GetResourceListCallback& callback) { 74 drive_service_->GetRemainingFileList(next_link, callback); 75} 76 77void DriveServiceWrapper::GetResourceEntry( 78 const std::string& resource_id, 79 const google_apis::GetResourceEntryCallback& callback) { 80 drive_service_->GetResourceEntry(resource_id, callback); 81} 82 83void DriveServiceWrapper::GetResourceListInDirectory( 84 const std::string& directory_resource_id, 85 const google_apis::GetResourceListCallback& callback) { 86 drive_service_->GetResourceListInDirectory(directory_resource_id, 87 callback); 88} 89 90bool DriveServiceWrapper::HasRefreshToken() const { 91 return drive_service_->HasRefreshToken(); 92} 93 94void 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); 100} 101 102void 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); 108} 109 110} // namespace drive_backend 111} // namespace sync_file_system 112