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

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

Issue 10008100: gdata: Support mouting archive file in GData cache (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Support mounting archive files under GData cache Created 8 years, 8 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
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_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
7 #pragma once 7 #pragma once
8 8
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 GDataFileBase* file)> 64 GDataFileBase* file)>
65 FindFileCallback; 65 FindFileCallback;
66 66
67 // Used to get files from the file system. 67 // Used to get files from the file system.
68 typedef base::Callback<void(base::PlatformFileError error, 68 typedef base::Callback<void(base::PlatformFileError error,
69 const FilePath& file_path, 69 const FilePath& file_path,
70 const std::string& mime_type, 70 const std::string& mime_type,
71 GDataFileType file_type)> 71 GDataFileType file_type)>
72 GetFileCallback; 72 GetFileCallback;
73 73
74 // Callback for SetMountedState.
75 typedef base::Callback<void(base::PlatformFileError error,
76 const FilePath& file_path,
77 const std::string& file_name,
78 const std::string& mount_type)>
79 SetMountedStateCallback;
80
74 // Used for file operations like removing files. 81 // Used for file operations like removing files.
75 typedef base::Callback<void(base::PlatformFileError error, 82 typedef base::Callback<void(base::PlatformFileError error,
76 base::ListValue* feed_list)> 83 base::ListValue* feed_list)>
77 GetJsonDocumentCallback; 84 GetJsonDocumentCallback;
78 85
79 // Used to get available space for the account from GData. 86 // Used to get available space for the account from GData.
80 typedef base::Callback<void(base::PlatformFileError error, 87 typedef base::Callback<void(base::PlatformFileError error,
81 int bytes_total, 88 int bytes_total,
82 int bytes_used)> 89 int bytes_used)>
83 GetAvailableSpaceCallback; 90 GetAvailableSpaceCallback;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual void Initialize() = 0; 183 virtual void Initialize() = 0;
177 184
178 // Adds and removes the observer. 185 // Adds and removes the observer.
179 virtual void AddObserver(Observer* observer) = 0; 186 virtual void AddObserver(Observer* observer) = 0;
180 virtual void RemoveObserver(Observer* observer) = 0; 187 virtual void RemoveObserver(Observer* observer) = 0;
181 188
182 // Enum defining origin of a cached file. 189 // Enum defining origin of a cached file.
183 enum CachedFileOrigin { 190 enum CachedFileOrigin {
184 CACHED_FILE_FROM_SERVER = 0, 191 CACHED_FILE_FROM_SERVER = 0,
185 CACHED_FILE_LOCALLY_MODIFIED, 192 CACHED_FILE_LOCALLY_MODIFIED,
193 CACHED_FILE_MOUNTED_ARCHIVE,
Ben Chan 2012/04/17 20:57:53 nit: prefer CACHED_FILE_IN_USE or CACHED_FILE_MOUN
tbarzic 2012/04/17 21:33:13 We should probably add CACHED_FILE_MOUNTED_ARCHIVE
hshi 2012/04/17 22:10:39 I am not sure that this applies to the case of mou
186 }; 194 };
187 195
188 // Enum defining type of file operation e.g. copy or move, etc. 196 // Enum defining type of file operation e.g. copy or move, etc.
189 // For now, it's used for StoreToCache. 197 // For now, it's used for StoreToCache.
190 enum FileOperationType { 198 enum FileOperationType {
191 FILE_OPERATION_MOVE = 0, 199 FILE_OPERATION_MOVE = 0,
192 FILE_OPERATION_COPY, 200 FILE_OPERATION_COPY,
193 }; 201 };
194 202
195 // Authenticates the user by fetching the auth token as 203 // Authenticates the user by fetching the auth token as
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // otherwise. 357 // otherwise.
350 virtual void GetCacheState(const std::string& resource_id, 358 virtual void GetCacheState(const std::string& resource_id,
351 const std::string& md5, 359 const std::string& md5,
352 const GetCacheStateCallback& callback) = 0; 360 const GetCacheStateCallback& callback) = 0;
353 361
354 // Finds file object by |file_path| and returns its key |properties|. 362 // Finds file object by |file_path| and returns its key |properties|.
355 // Returns true if file was found. 363 // Returns true if file was found.
356 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path, 364 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
357 GDataFileProperties* properties) = 0; 365 GDataFileProperties* properties) = 0;
358 366
367 // Returns true if the given path is under gdata cache directory, i.e.
368 // <user_profile_dir>/GCache/v1
369 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const = 0;
370
359 // Returns the tmp sub-directory under gdata cache directory, i.e. 371 // Returns the tmp sub-directory under gdata cache directory, i.e.
360 // <user_profile_dir>/GCache/v1/tmp 372 // <user_profile_dir>/GCache/v1/tmp
361 virtual FilePath GetGDataCacheTmpDirectory() const = 0; 373 virtual FilePath GetGDataCacheTmpDirectory() const = 0;
362 374
363 // Returns the tmp downloads sub-directory under gdata cache directory, i.e. 375 // Returns the tmp downloads sub-directory under gdata cache directory, i.e.
364 // <user_profile_dir>/GCache/v1/tmp/downloads/ 376 // <user_profile_dir>/GCache/v1/tmp/downloads/
365 virtual FilePath GetGDataTempDownloadFolderPath() const = 0; 377 virtual FilePath GetGDataTempDownloadFolderPath() const = 0;
366 378
367 // Returns the tmp documents sub-directory under gdata cache directory, i.e. 379 // Returns the tmp documents sub-directory under gdata cache directory, i.e.
368 // <user_profile_dir>/GCache/v1/tmp/documents/ 380 // <user_profile_dir>/GCache/v1/tmp/documents/
(...skipping 15 matching lines...) Expand all
384 CachedFileOrigin file_orign) const = 0; 396 CachedFileOrigin file_orign) const = 0;
385 397
386 // Fetches the user's Account Metadata to find out current quota information 398 // Fetches the user's Account Metadata to find out current quota information
387 // and returns it to the callback. 399 // and returns it to the callback.
388 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0; 400 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0;
389 401
390 // Pin or unpin file. 402 // Pin or unpin file.
391 virtual void SetPinState(const FilePath& file_path, bool to_pin, 403 virtual void SetPinState(const FilePath& file_path, bool to_pin,
392 const FileOperationCallback& callback) = 0; 404 const FileOperationCallback& callback) = 0;
393 405
406 // Set mounted state of an archive
Ben Chan 2012/04/17 20:57:53 Prefer a more elaborated comment, e.g. Marks a fi
tbarzic 2012/04/17 21:33:13 Also, comments must end with .
407 virtual void SetMountedState(const FilePath& file_path,
408 const std::string& file_name,
Ben Chan 2012/04/17 20:57:53 const FilePath::StringType&
409 const std::string& mount_type,
410 const SetMountedStateCallback& callback) = 0;
411
412 // Clear mounted state of an archive
Ben Chan 2012/04/17 20:57:53 ditto
413 virtual void ClearMountedState(const FilePath& file_path,
414 const FileOperationCallback& callback) = 0;
415
394 // Creates a new file from |entry| under |virtual_dir_path|. Stored its 416 // Creates a new file from |entry| under |virtual_dir_path|. Stored its
395 // content from |file_content_path| into the cache. 417 // content from |file_content_path| into the cache.
396 virtual void AddUploadedFile(const FilePath& virtual_dir_path, 418 virtual void AddUploadedFile(const FilePath& virtual_dir_path,
397 DocumentEntry* entry, 419 DocumentEntry* entry,
398 const FilePath& file_content_path, 420 const FilePath& file_content_path,
399 FileOperationType cache_operation) = 0; 421 FileOperationType cache_operation) = 0;
400 422
401 // Returns true if hosted documents should be hidden. 423 // Returns true if hosted documents should be hidden.
402 virtual bool hide_hosted_documents() = 0; 424 virtual bool hide_hosted_documents() = 0;
403 }; 425 };
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 virtual bool CancelOperation(const FilePath& file_path) OVERRIDE; 472 virtual bool CancelOperation(const FilePath& file_path) OVERRIDE;
451 virtual void AddOperationObserver( 473 virtual void AddOperationObserver(
452 GDataOperationRegistry::Observer* observer) OVERRIDE; 474 GDataOperationRegistry::Observer* observer) OVERRIDE;
453 virtual void RemoveOperationObserver( 475 virtual void RemoveOperationObserver(
454 GDataOperationRegistry::Observer* observer) OVERRIDE; 476 GDataOperationRegistry::Observer* observer) OVERRIDE;
455 virtual void GetCacheState(const std::string& resource_id, 477 virtual void GetCacheState(const std::string& resource_id,
456 const std::string& md5, 478 const std::string& md5,
457 const GetCacheStateCallback& callback) OVERRIDE; 479 const GetCacheStateCallback& callback) OVERRIDE;
458 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path, 480 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
459 GDataFileProperties* properties) OVERRIDE; 481 GDataFileProperties* properties) OVERRIDE;
482 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE;
460 virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE; 483 virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE;
461 virtual FilePath GetGDataTempDownloadFolderPath() const OVERRIDE; 484 virtual FilePath GetGDataTempDownloadFolderPath() const OVERRIDE;
462 virtual FilePath GetGDataTempDocumentFolderPath() const OVERRIDE; 485 virtual FilePath GetGDataTempDocumentFolderPath() const OVERRIDE;
463 virtual FilePath GetGDataCachePinnedDirectory() const OVERRIDE; 486 virtual FilePath GetGDataCachePinnedDirectory() const OVERRIDE;
464 virtual FilePath GetGDataCachePersistentDirectory() const OVERRIDE; 487 virtual FilePath GetGDataCachePersistentDirectory() const OVERRIDE;
465 virtual FilePath GetCacheFilePath( 488 virtual FilePath GetCacheFilePath(
466 const std::string& resource_id, 489 const std::string& resource_id,
467 const std::string& md5, 490 const std::string& md5,
468 GDataRootDirectory::CacheSubDirectoryType sub_dir_type, 491 GDataRootDirectory::CacheSubDirectoryType sub_dir_type,
469 CachedFileOrigin file_orign) const OVERRIDE; 492 CachedFileOrigin file_orign) const OVERRIDE;
470 virtual void GetAvailableSpace( 493 virtual void GetAvailableSpace(
471 const GetAvailableSpaceCallback& callback) OVERRIDE; 494 const GetAvailableSpaceCallback& callback) OVERRIDE;
472 // Calls private Pin or Unpin methods with |callback|. 495 // Calls private Pin or Unpin methods with |callback|.
473 virtual void SetPinState(const FilePath& file_path, bool pin, 496 virtual void SetPinState(const FilePath& file_path, bool pin,
474 const FileOperationCallback& callback) OVERRIDE; 497 const FileOperationCallback& callback) OVERRIDE;
498 virtual void SetMountedState(const FilePath& file_path,
499 const std::string& file_name,
tbarzic 2012/04/17 21:33:13 fix indent
500 const std::string& mount_type,
501 const SetMountedStateCallback& callback) OVERRIDE;
502 virtual void ClearMountedState(const FilePath& file_path,
503 const FileOperationCallback& callback) OVERRIDE;
475 virtual void AddUploadedFile(const FilePath& virtual_dir_path, 504 virtual void AddUploadedFile(const FilePath& virtual_dir_path,
476 DocumentEntry* entry, 505 DocumentEntry* entry,
477 const FilePath& file_content_path, 506 const FilePath& file_content_path,
478 FileOperationType cache_operation) OVERRIDE; 507 FileOperationType cache_operation) OVERRIDE;
479 virtual bool hide_hosted_documents() OVERRIDE; 508 virtual bool hide_hosted_documents() OVERRIDE;
480 509
481 // content::NotificationObserver implementation. 510 // content::NotificationObserver implementation.
482 virtual void Observe(int type, 511 virtual void Observe(int type,
483 const content::NotificationSource& source, 512 const content::NotificationSource& source,
484 const content::NotificationDetails& details) OVERRIDE; 513 const content::NotificationDetails& details) OVERRIDE;
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 }; 1390 };
1362 1391
1363 // Sets the free disk space getter for testing. 1392 // Sets the free disk space getter for testing.
1364 // The existing getter is deleted. 1393 // The existing getter is deleted.
1365 void SetFreeDiskSpaceGetterForTesting( 1394 void SetFreeDiskSpaceGetterForTesting(
1366 FreeDiskSpaceGetterInterface* getter); 1395 FreeDiskSpaceGetterInterface* getter);
1367 1396
1368 } // namespace gdata 1397 } // namespace gdata
1369 1398
1370 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 1399 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698