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

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

Issue 9808023: Grant file access permissions for cached file paths to file browsers/handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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_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 7
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path, 311 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
312 GDataFileProperties* properties) = 0; 312 GDataFileProperties* properties) = 0;
313 313
314 // Returns the tmp sub-directory under gdata cache directory, i.e. 314 // Returns the tmp sub-directory under gdata cache directory, i.e.
315 // <user_profile_dir>/GCache/v1/tmp 315 // <user_profile_dir>/GCache/v1/tmp
316 virtual FilePath GetGDataCacheTmpDirectory() const = 0; 316 virtual FilePath GetGDataCacheTmpDirectory() const = 0;
317 317
318 // Returns the pinned sub-directory under gdata cache directory, i.e. 318 // Returns the pinned sub-directory under gdata cache directory, i.e.
319 // <user_profile_dir>/GCache/v1/pinned 319 // <user_profile_dir>/GCache/v1/pinned
320 virtual FilePath GetGDataCachePinnedDirectory() const = 0; 320 virtual FilePath GetGDataCachePinnedDirectory() const = 0;
321 // Returns absolute path of the file if it were cached or to be cached.
322 virtual FilePath GetCacheFilePath(const std::string& resource_id,
323 const std::string& md5,
324 CacheSubdir subdir_id,
325 CachedFileOrigin file_orign) const = 0;
satorux1 2012/03/22 22:28:29 You should probably update mock_gdata_file_system.
tonibarzic 2012/03/22 23:38:20 Yeah, I usually remember this when try job fails :
321 326
322 // Fetches the user's Account Metadata to find out current quota information 327 // Fetches the user's Account Metadata to find out current quota information
323 // and returns it to the callback. 328 // and returns it to the callback.
324 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0; 329 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0;
325 }; 330 };
326 331
327 // The production implementation of GDataFileSystemInterface. 332 // The production implementation of GDataFileSystemInterface.
328 class GDataFileSystem : public GDataFileSystemInterface, 333 class GDataFileSystem : public GDataFileSystemInterface,
329 public ProfileKeyedService { 334 public ProfileKeyedService {
330 public: 335 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 GDataOperationRegistry::Observer* observer) OVERRIDE; 370 GDataOperationRegistry::Observer* observer) OVERRIDE;
366 virtual void RemoveOperationObserver( 371 virtual void RemoveOperationObserver(
367 GDataOperationRegistry::Observer* observer) OVERRIDE; 372 GDataOperationRegistry::Observer* observer) OVERRIDE;
368 virtual void GetCacheState(const std::string& resource_id, 373 virtual void GetCacheState(const std::string& resource_id,
369 const std::string& md5, 374 const std::string& md5,
370 const GetCacheStateCallback& callback) OVERRIDE; 375 const GetCacheStateCallback& callback) OVERRIDE;
371 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path, 376 virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
372 GDataFileProperties* properties) OVERRIDE; 377 GDataFileProperties* properties) OVERRIDE;
373 virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE; 378 virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE;
374 virtual FilePath GetGDataCachePinnedDirectory() const OVERRIDE; 379 virtual FilePath GetGDataCachePinnedDirectory() const OVERRIDE;
380 virtual FilePath GetCacheFilePath(const std::string& resource_id,
381 const std::string& md5,
382 CacheSubdir subdir_id,
383 CachedFileOrigin file_orign) const OVERRIDE;
375 virtual void GetAvailableSpace( 384 virtual void GetAvailableSpace(
376 const GetAvailableSpaceCallback& callback) OVERRIDE; 385 const GetAvailableSpaceCallback& callback) OVERRIDE;
377 386
378 private: 387 private:
379 friend class GDataUploader; 388 friend class GDataUploader;
380 friend class GDataFileSystemFactory; 389 friend class GDataFileSystemFactory;
381 friend class GDataFileSystemTest; 390 friend class GDataFileSystemTest;
382 FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest, 391 FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
383 FindFirstMissingParentDirectory); 392 FindFirstMissingParentDirectory);
384 FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest, 393 FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // Cache entry points from within GDataFileSystem. 707 // Cache entry points from within GDataFileSystem.
699 // The functionalities of GData blob cache include: 708 // The functionalities of GData blob cache include:
700 // - stores downloaded gdata files on disk, indexed by the resource_id and md5 709 // - stores downloaded gdata files on disk, indexed by the resource_id and md5
701 // of the gdata file. 710 // of the gdata file.
702 // - provides absolute path for files to be cached or cached. 711 // - provides absolute path for files to be cached or cached.
703 // - updates the cached file on disk after user has edited it locally 712 // - updates the cached file on disk after user has edited it locally
704 // - handles eviction when disk runs out of space 713 // - handles eviction when disk runs out of space
705 // - uploads dirty files to gdata server. 714 // - uploads dirty files to gdata server.
706 // - etc. 715 // - etc.
707 716
708 // Returns absolute path of the file if it were cached or to be cached.
709 FilePath GetCacheFilePath(const std::string& resource_id,
710 const std::string& md5,
711 CacheSubdir subdir_id,
712 CachedFileOrigin file_orign);
713
714 // Stores |source_path| corresponding to |resource_id| and |md5| to cache. 717 // Stores |source_path| corresponding to |resource_id| and |md5| to cache.
715 // Initializes cache if it has not been initialized. 718 // Initializes cache if it has not been initialized.
716 // Upon completion, |callback| is invoked on the thread where this method was 719 // Upon completion, |callback| is invoked on the thread where this method was
717 // called. 720 // called.
718 void StoreToCache(const std::string& resource_id, 721 void StoreToCache(const std::string& resource_id,
719 const std::string& md5, 722 const std::string& md5,
720 const FilePath& source_path, 723 const FilePath& source_path,
721 const CacheOperationCallback& callback); 724 const CacheOperationCallback& callback);
722 725
723 // Checks if file corresponding to |resource_id| and |md5| exist on disk and 726 // Checks if file corresponding to |resource_id| and |md5| exist on disk and
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 virtual ~GDataFileSystemFactory(); 908 virtual ~GDataFileSystemFactory();
906 909
907 // ProfileKeyedServiceFactory: 910 // ProfileKeyedServiceFactory:
908 virtual ProfileKeyedService* BuildServiceInstanceFor( 911 virtual ProfileKeyedService* BuildServiceInstanceFor(
909 Profile* profile) const OVERRIDE; 912 Profile* profile) const OVERRIDE;
910 }; 913 };
911 914
912 } // namespace gdata 915 } // namespace gdata
913 916
914 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 917 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698