drive_service_wrapper.h 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#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ 6#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ 7 8#include "base/memory/weak_ptr.h" 9#include "chrome/browser/drive/drive_service_interface.h" 10 11namespace sync_file_system { 12namespace drive_backend { 13 14// This class wraps a part of DriveServiceInterface class to support weak 15// pointer. Each method wraps corresponding name method of 16// DriveServiceInterface. See comments in drive_service_interface.h 17// for details. 18class DriveServiceWrapper : public base::SupportsWeakPtr<DriveServiceWrapper> { 19 public: 20 explicit DriveServiceWrapper(drive::DriveServiceInterface* drive_service); 21 22 void AddNewDirectory( 23 const std::string& parent_resource_id, 24 const std::string& directory_title, 25 const drive::DriveServiceInterface::AddNewDirectoryOptions& options, 26 const google_apis::GetResourceEntryCallback& callback); 27 28 void DeleteResource( 29 const std::string& resource_id, 30 const std::string& etag, 31 const google_apis::EntryActionCallback& callback); 32 33 void DownloadFile( 34 const base::FilePath& local_cache_path, 35 const std::string& resource_id, 36 const google_apis::DownloadActionCallback& download_action_callback, 37 const google_apis::GetContentCallback& get_content_callback, 38 const google_apis::ProgressCallback& progress_callback); 39 40 void GetAboutResource( 41 const google_apis::AboutResourceCallback& callback); 42 43 void GetChangeList( 44 int64 start_changestamp, 45 const google_apis::ChangeListCallback& callback); 46 47 void GetRemainingChangeList( 48 const GURL& next_link, 49 const google_apis::ChangeListCallback& callback); 50 51 void GetRemainingFileList( 52 const GURL& next_link, 53 const google_apis::GetResourceListCallback& callback); 54 55 void GetResourceEntry( 56 const std::string& resource_id, 57 const google_apis::GetResourceEntryCallback& callback); 58 59 void GetResourceListInDirectory( 60 const std::string& directory_resource_id, 61 const google_apis::GetResourceListCallback& callback); 62 63 bool HasRefreshToken() const; 64 65 void RemoveResourceFromDirectory( 66 const std::string& parent_resource_id, 67 const std::string& resource_id, 68 const google_apis::EntryActionCallback& callback); 69 70 void SearchByTitle( 71 const std::string& title, 72 const std::string& directory_resource_id, 73 const google_apis::GetResourceListCallback& callback); 74 75 private: 76 drive::DriveServiceInterface* drive_service_; 77 78 DISALLOW_COPY_AND_ASSIGN(DriveServiceWrapper); 79}; 80 81} // namespace drive_backend 82} // namespace sync_file_system 83 84#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ 85