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 #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_
8 #include "base/memory/weak_ptr.h"
9 #include "base/sequence_checker.h"
10 #include "components/drive/service/drive_service_interface.h"
12 namespace sync_file_system
{
13 namespace drive_backend
{
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
19 class DriveServiceWrapper
: public base::SupportsWeakPtr
<DriveServiceWrapper
> {
21 explicit DriveServiceWrapper(drive::DriveServiceInterface
* drive_service
);
23 void AddNewDirectory(const std::string
& parent_resource_id
,
24 const std::string
& directory_title
,
25 const drive::AddNewDirectoryOptions
& options
,
26 const google_apis::FileResourceCallback
& callback
);
29 const std::string
& resource_id
,
30 const std::string
& etag
,
31 const google_apis::EntryActionCallback
& callback
);
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
);
40 void GetAboutResource(
41 const google_apis::AboutResourceCallback
& callback
);
44 int64 start_changestamp
,
45 const google_apis::ChangeListCallback
& callback
);
47 void GetRemainingChangeList(
48 const GURL
& next_link
,
49 const google_apis::ChangeListCallback
& callback
);
51 void GetRemainingFileList(
52 const GURL
& next_link
,
53 const google_apis::FileListCallback
& callback
);
56 const std::string
& resource_id
,
57 const google_apis::FileResourceCallback
& callback
);
59 void GetFileListInDirectory(
60 const std::string
& directory_resource_id
,
61 const google_apis::FileListCallback
& callback
);
63 void RemoveResourceFromDirectory(
64 const std::string
& parent_resource_id
,
65 const std::string
& resource_id
,
66 const google_apis::EntryActionCallback
& callback
);
69 const std::string
& title
,
70 const std::string
& directory_resource_id
,
71 const google_apis::FileListCallback
& callback
);
74 drive::DriveServiceInterface
* drive_service_
;
75 base::SequenceChecker sequece_checker_
;
77 DISALLOW_COPY_AND_ASSIGN(DriveServiceWrapper
);
80 } // namespace drive_backend
81 } // namespace sync_file_system
83 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_