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