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_UPLOADER_WRAPPER_H_
      6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_UPLOADER_WRAPPER_H_
      7 
      8 #include "base/memory/weak_ptr.h"
      9 #include "base/sequence_checker.h"
     10 #include "chrome/browser/drive/drive_uploader.h"
     11 
     12 namespace sync_file_system {
     13 namespace drive_backend {
     14 
     15 // This class wraps a part of DriveUploaderInterface class to support weak
     16 // pointer.  Each method wraps corresponding name method of
     17 // DriveUploaderInterface.  See comments in drive_uploader_interface.h
     18 // for details.
     19 class DriveUploaderWrapper
     20     : public base::SupportsWeakPtr<DriveUploaderWrapper> {
     21  public:
     22   explicit DriveUploaderWrapper(drive::DriveUploaderInterface* drive_uploader);
     23 
     24   void UploadExistingFile(
     25       const std::string& resource_id,
     26       const base::FilePath& local_file_path,
     27       const std::string& content_type,
     28       const drive::DriveUploaderInterface::UploadExistingFileOptions& options,
     29       const drive::UploadCompletionCallback& callback);
     30 
     31   void UploadNewFile(
     32       const std::string& parent_resource_id,
     33       const base::FilePath& local_file_path,
     34       const std::string& title,
     35       const std::string& content_type,
     36       const drive::DriveUploaderInterface::UploadNewFileOptions& options,
     37       const drive::UploadCompletionCallback& callback);
     38 
     39  private:
     40   drive::DriveUploaderInterface* drive_uploader_;
     41   base::SequenceChecker sequence_checker_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(DriveUploaderWrapper);
     44 };
     45 
     46 }  // namespace drive_backend
     47 }  // namespace sync_file_system
     48 
     49 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_UPLOADER_WRAPPER_H_
     50