Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/browser/chromeos/gdata/drive_file_system_interface.h

Issue 10874028: Rename GDataFileSystem* to DriveFileSystem* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remaining manual changes Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_INTERFACE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_INTERFACE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_INTERFACE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_INTERFACE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/chromeos/gdata/drive_cache.h" 12 #include "chrome/browser/chromeos/gdata/drive_cache.h"
13 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" 13 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h"
14 #include "chrome/browser/chromeos/gdata/gdata_operations.h" 14 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
15 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" 15 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
16 16
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 typedef base::Callback<void( 55 typedef base::Callback<void(
56 DriveFileError error, 56 DriveFileError error,
57 const GURL& next_feed, 57 const GURL& next_feed,
58 scoped_ptr<std::vector<SearchResultInfo> > result_paths)> SearchCallback; 58 scoped_ptr<std::vector<SearchResultInfo> > result_paths)> SearchCallback;
59 59
60 // Used to open files from the file system. |file_path| is the path on the local 60 // Used to open files from the file system. |file_path| is the path on the local
61 // file system for the opened file. 61 // file system for the opened file.
62 typedef base::Callback<void(DriveFileError error, 62 typedef base::Callback<void(DriveFileError error,
63 const FilePath& file_path)> OpenFileCallback; 63 const FilePath& file_path)> OpenFileCallback;
64 64
65 // Used to get available space for the account from GData. 65 // Used to get available space for the account from Drive.
66 typedef base::Callback<void(DriveFileError error, 66 typedef base::Callback<void(DriveFileError error,
67 int64 bytes_total, 67 int64 bytes_total,
68 int64 bytes_used)> GetAvailableSpaceCallback; 68 int64 bytes_used)> GetAvailableSpaceCallback;
69 69
70 // GData file system abstraction layer. 70 // Drive file system abstraction layer.
71 // The interface is defined to make GDataFileSystem mockable. 71 // The interface is defined to make DriveFileSystem mockable.
72 class GDataFileSystemInterface { 72 class DriveFileSystemInterface {
73 public: 73 public:
74 virtual ~GDataFileSystemInterface() {} 74 virtual ~DriveFileSystemInterface() {}
75 75
76 // Used to notify events on the file system. 76 // Used to notify events on the file system.
77 // All events are notified on UI thread. 77 // All events are notified on UI thread.
78 class Observer { 78 class Observer {
79 public: 79 public:
80 // Triggered when a content of a directory has been changed. 80 // Triggered when a content of a directory has been changed.
81 // |directory_path| is a virtual directory path (/gdata/...) representing 81 // |directory_path| is a virtual directory path (/gdata/...) representing
82 // changed directory. 82 // changed directory.
83 virtual void OnDirectoryChanged(const FilePath& directory_path) {} 83 virtual void OnDirectoryChanged(const FilePath& directory_path) {}
84 84
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Finds an entry (file or directory) by using |resource_id|. This call 125 // Finds an entry (file or directory) by using |resource_id|. This call
126 // does not initiate content refreshing. 126 // does not initiate content refreshing.
127 // 127 //
128 // Can be called from UI/IO thread. |callback| is run on the calling thread. 128 // Can be called from UI/IO thread. |callback| is run on the calling thread.
129 // |callback| must not be null. 129 // |callback| must not be null.
130 virtual void GetEntryInfoByResourceId( 130 virtual void GetEntryInfoByResourceId(
131 const std::string& resource_id, 131 const std::string& resource_id,
132 const GetEntryInfoWithFilePathCallback& callback) = 0; 132 const GetEntryInfoWithFilePathCallback& callback) = 0;
133 133
134 // Initiates transfer of |remote_src_file_path| to |local_dest_file_path|. 134 // Initiates transfer of |remote_src_file_path| to |local_dest_file_path|.
135 // |remote_src_file_path| is the virtual source path on the gdata file system. 135 // |remote_src_file_path| is the virtual source path on the Drive file system.
136 // |local_dest_file_path| is the destination path on the local file system. 136 // |local_dest_file_path| is the destination path on the local file system.
137 // 137 //
138 // Must be called from *UI* thread. |callback| is run on the calling thread. 138 // Must be called from *UI* thread. |callback| is run on the calling thread.
139 // |callback| must not be null. 139 // |callback| must not be null.
140 virtual void TransferFileFromRemoteToLocal( 140 virtual void TransferFileFromRemoteToLocal(
141 const FilePath& remote_src_file_path, 141 const FilePath& remote_src_file_path,
142 const FilePath& local_dest_file_path, 142 const FilePath& local_dest_file_path,
143 const FileOperationCallback& callback) = 0; 143 const FileOperationCallback& callback) = 0;
144 144
145 // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|. 145 // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|.
146 // |local_src_file_path| must be a file from the local file system. 146 // |local_src_file_path| must be a file from the local file system.
147 // |remote_dest_file_path| is the virtual destination path within gdata file 147 // |remote_dest_file_path| is the virtual destination path within Drive file
148 // system. 148 // system.
149 // 149 //
150 // Must be called from *UI* thread. |callback| is run on the calling thread. 150 // Must be called from *UI* thread. |callback| is run on the calling thread.
151 // |callback| must not be null. 151 // |callback| must not be null.
152 virtual void TransferFileFromLocalToRemote( 152 virtual void TransferFileFromLocalToRemote(
153 const FilePath& local_src_file_path, 153 const FilePath& local_src_file_path,
154 const FilePath& remote_dest_file_path, 154 const FilePath& remote_dest_file_path,
155 const FileOperationCallback& callback) = 0; 155 const FileOperationCallback& callback) = 0;
156 156
157 // Retrieves a file at the virtual path |file_path| on the gdata file system 157 // Retrieves a file at the virtual path |file_path| on the Drive file system
158 // onto the cache, and mark it dirty. The local path to the cache file is 158 // onto the cache, and mark it dirty. The local path to the cache file is
159 // returned to |callback|. After opening the file, both read and write 159 // returned to |callback|. After opening the file, both read and write
160 // on the file can be done with normal local file operations. 160 // on the file can be done with normal local file operations.
161 // 161 //
162 // |CloseFile| must be called when the modification to the cache is done. 162 // |CloseFile| must be called when the modification to the cache is done.
163 // Otherwise, GData file system does not pick up the file for uploading. 163 // Otherwise, Drive file system does not pick up the file for uploading.
164 // 164 //
165 // Can be called from UI/IO thread. |callback| is run on the calling thread. 165 // Can be called from UI/IO thread. |callback| is run on the calling thread.
166 virtual void OpenFile(const FilePath& file_path, 166 virtual void OpenFile(const FilePath& file_path,
167 const OpenFileCallback& callback) = 0; 167 const OpenFileCallback& callback) = 0;
168 168
169 // Closes a file at the virtual path |file_path| on the gdata file system, 169 // Closes a file at the virtual path |file_path| on the Drive file system,
170 // which is opened via OpenFile(). It commits the dirty flag on the cache. 170 // which is opened via OpenFile(). It commits the dirty flag on the cache.
171 // 171 //
172 // Can be called from UI/IO thread. |callback| is run on the calling thread. 172 // Can be called from UI/IO thread. |callback| is run on the calling thread.
173 // |callback| must not be null. 173 // |callback| must not be null.
174 virtual void CloseFile(const FilePath& file_path, 174 virtual void CloseFile(const FilePath& file_path,
175 const FileOperationCallback& callback) = 0; 175 const FileOperationCallback& callback) = 0;
176 176
177 // Copies |src_file_path| to |dest_file_path| on the file system. 177 // Copies |src_file_path| to |dest_file_path| on the file system.
178 // |src_file_path| can be a hosted document (see limitations below). 178 // |src_file_path| can be a hosted document (see limitations below).
179 // |dest_file_path| is expected to be of the same type of |src_file_path| 179 // |dest_file_path| is expected to be of the same type of |src_file_path|
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // 249 //
250 // Can be called from UI/IO thread. |callback| is run on the calling thread 250 // Can be called from UI/IO thread. |callback| is run on the calling thread
251 // |callback| must not be null. 251 // |callback| must not be null.
252 virtual void CreateFile(const FilePath& file_path, 252 virtual void CreateFile(const FilePath& file_path,
253 bool is_exclusive, 253 bool is_exclusive,
254 const FileOperationCallback& callback) = 0; 254 const FileOperationCallback& callback) = 0;
255 255
256 // Gets |file_path| from the file system. The file entry represented by 256 // Gets |file_path| from the file system. The file entry represented by
257 // |file_path| needs to be present in in-memory representation of the file 257 // |file_path| needs to be present in in-memory representation of the file
258 // system in order to be retrieved. If the file is not cached, the file 258 // system in order to be retrieved. If the file is not cached, the file
259 // will be downloaded through gdata api. 259 // will be downloaded through GData API or Drive V2 API.
260 // 260 //
261 // Can be called from UI/IO thread. |get_file_callback| and 261 // Can be called from UI/IO thread. |get_file_callback| and
262 // |get_content_callback| are run on the calling thread. 262 // |get_content_callback| are run on the calling thread.
263 virtual void GetFileByPath( 263 virtual void GetFileByPath(
264 const FilePath& file_path, 264 const FilePath& file_path,
265 const GetFileCallback& get_file_callback, 265 const GetFileCallback& get_file_callback,
266 const GetContentCallback& get_content_callback) = 0; 266 const GetContentCallback& get_content_callback) = 0;
267 267
268 // Gets a file by the given |resource_id| from the gdata server. Used for 268 // Gets a file by the given |resource_id| from the Drive server. Used for
269 // fetching pinned-but-not-fetched files. 269 // fetching pinned-but-not-fetched files.
270 // 270 //
271 // Can be called from UI/IO thread. |get_file_callback| and 271 // Can be called from UI/IO thread. |get_file_callback| and
272 // |get_content_callback| are run on the calling thread. 272 // |get_content_callback| are run on the calling thread.
273 virtual void GetFileByResourceId( 273 virtual void GetFileByResourceId(
274 const std::string& resource_id, 274 const std::string& resource_id,
275 const GetFileCallback& get_file_callback, 275 const GetFileCallback& get_file_callback,
276 const GetContentCallback& get_content_callback) = 0; 276 const GetContentCallback& get_content_callback) = 0;
277 277
278 // Updates a file by the given |resource_id| on the gdata server by 278 // Updates a file by the given |resource_id| on the Drive server by
279 // uploading an updated version. Used for uploading dirty files. The file 279 // uploading an updated version. Used for uploading dirty files. The file
280 // should already be present in the cache. 280 // should already be present in the cache.
281 // 281 //
282 // TODO(satorux): As of now, the function only handles files with the dirty 282 // TODO(satorux): As of now, the function only handles files with the dirty
283 // bit committed. We should eliminate the restriction. crbug.com/134558. 283 // bit committed. We should eliminate the restriction. crbug.com/134558.
284 // 284 //
285 // Can be called from UI/IO thread. |callback| and is run on the calling 285 // Can be called from UI/IO thread. |callback| and is run on the calling
286 // thread. |callback| must not be null. 286 // thread. |callback| must not be null.
287 virtual void UpdateFileByResourceId( 287 virtual void UpdateFileByResourceId(
288 const std::string& resource_id, 288 const std::string& resource_id,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // |callback| will be called on the UI thread upon completion of operation. 358 // |callback| will be called on the UI thread upon completion of operation.
359 virtual void UpdateEntryData(const std::string& resource_id, 359 virtual void UpdateEntryData(const std::string& resource_id,
360 const std::string& md5, 360 const std::string& md5,
361 scoped_ptr<DocumentEntry> entry, 361 scoped_ptr<DocumentEntry> entry,
362 const FilePath& file_content_path, 362 const FilePath& file_content_path,
363 const base::Closure& callback) = 0; 363 const base::Closure& callback) = 0;
364 }; 364 };
365 365
366 } // namespace gdata 366 } // namespace gdata
367 367
368 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_INTERFACE_H_ 368 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698