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

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

Issue 10545084: Move chromeos::GDataFileSystem::GetCacheDirectoryPath and GetCacheFilePath implementation to GDataC… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual void AddObserver(Observer* observer) = 0; 176 virtual void AddObserver(Observer* observer) = 0;
177 virtual void RemoveObserver(Observer* observer) = 0; 177 virtual void RemoveObserver(Observer* observer) = 0;
178 178
179 // Starts and stops periodic updates. 179 // Starts and stops periodic updates.
180 virtual void StartUpdates() = 0; 180 virtual void StartUpdates() = 0;
181 virtual void StopUpdates() = 0; 181 virtual void StopUpdates() = 0;
182 182
183 // Checks for updates on the server. 183 // Checks for updates on the server.
184 virtual void CheckForUpdates() = 0; 184 virtual void CheckForUpdates() = 0;
185 185
186 // Enum defining origin of a cached file.
187 enum CachedFileOrigin {
188 CACHED_FILE_FROM_SERVER = 0,
189 CACHED_FILE_LOCALLY_MODIFIED,
190 CACHED_FILE_MOUNTED,
191 };
192
193 // Enum defining type of file operation e.g. copy or move, etc. 186 // Enum defining type of file operation e.g. copy or move, etc.
194 // For now, it's used for StoreToCache. 187 // For now, it's used for StoreToCache.
195 enum FileOperationType { 188 enum FileOperationType {
196 FILE_OPERATION_MOVE = 0, 189 FILE_OPERATION_MOVE = 0,
197 FILE_OPERATION_COPY, 190 FILE_OPERATION_COPY,
198 }; 191 };
199 192
200 // Authenticates the user by fetching the auth token as 193 // Authenticates the user by fetching the auth token as
201 // needed. |callback| will be run with the error code and the auth 194 // needed. |callback| will be run with the error code and the auth
202 // token, on the thread this function is run. 195 // token, on the thread this function is run.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // Returns the sub-directory under gdata cache directory for the given sub 406 // Returns the sub-directory under gdata cache directory for the given sub
414 // directory type. Example: <user_profile_dir>/GCache/v1/tmp 407 // directory type. Example: <user_profile_dir>/GCache/v1/tmp
415 virtual FilePath GetCacheDirectoryPath( 408 virtual FilePath GetCacheDirectoryPath(
416 GDataCache::CacheSubDirectoryType sub_dir_type) const = 0; 409 GDataCache::CacheSubDirectoryType sub_dir_type) const = 0;
417 410
418 // Returns absolute path of the file if it were cached or to be cached. 411 // Returns absolute path of the file if it were cached or to be cached.
419 virtual FilePath GetCacheFilePath( 412 virtual FilePath GetCacheFilePath(
420 const std::string& resource_id, 413 const std::string& resource_id,
421 const std::string& md5, 414 const std::string& md5,
422 GDataCache::CacheSubDirectoryType sub_dir_type, 415 GDataCache::CacheSubDirectoryType sub_dir_type,
423 CachedFileOrigin file_orign) const = 0; 416 GDataCache::CachedFileOrigin file_orign) const = 0;
424 417
425 // Fetches the user's Account Metadata to find out current quota information 418 // Fetches the user's Account Metadata to find out current quota information
426 // and returns it to the callback. 419 // and returns it to the callback.
427 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0; 420 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0;
428 421
429 // Pin or unpin file. 422 // Pin or unpin file.
430 virtual void SetPinState(const FilePath& file_path, bool to_pin, 423 virtual void SetPinState(const FilePath& file_path, bool to_pin,
431 const FileOperationCallback& callback) = 0; 424 const FileOperationCallback& callback) = 0;
432 425
433 // Marks or unmarks a file as locally mounted. 426 // Marks or unmarks a file as locally mounted.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 const FilePath& file_path) OVERRIDE; 510 const FilePath& file_path) OVERRIDE;
518 virtual bool GetFileInfoByPath(const FilePath& file_path, 511 virtual bool GetFileInfoByPath(const FilePath& file_path,
519 GDataFileProperties* properties) OVERRIDE; 512 GDataFileProperties* properties) OVERRIDE;
520 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE; 513 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE;
521 virtual FilePath GetCacheDirectoryPath( 514 virtual FilePath GetCacheDirectoryPath(
522 GDataCache::CacheSubDirectoryType sub_dir_type) const OVERRIDE; 515 GDataCache::CacheSubDirectoryType sub_dir_type) const OVERRIDE;
523 virtual FilePath GetCacheFilePath( 516 virtual FilePath GetCacheFilePath(
524 const std::string& resource_id, 517 const std::string& resource_id,
525 const std::string& md5, 518 const std::string& md5,
526 GDataCache::CacheSubDirectoryType sub_dir_type, 519 GDataCache::CacheSubDirectoryType sub_dir_type,
527 CachedFileOrigin file_orign) const OVERRIDE; 520 GDataCache::CachedFileOrigin file_orign) const OVERRIDE;
528 virtual void GetAvailableSpace( 521 virtual void GetAvailableSpace(
529 const GetAvailableSpaceCallback& callback) OVERRIDE; 522 const GetAvailableSpaceCallback& callback) OVERRIDE;
530 // Calls private Pin or Unpin methods with |callback|. 523 // Calls private Pin or Unpin methods with |callback|.
531 virtual void SetPinState(const FilePath& file_path, bool pin, 524 virtual void SetPinState(const FilePath& file_path, bool pin,
532 const FileOperationCallback& callback) OVERRIDE; 525 const FileOperationCallback& callback) OVERRIDE;
533 virtual void SetMountedState( 526 virtual void SetMountedState(
534 const FilePath& file_path, 527 const FilePath& file_path,
535 bool to_mount, 528 bool to_mount,
536 const SetMountedStateCallback& callback) OVERRIDE; 529 const SetMountedStateCallback& callback) OVERRIDE;
537 virtual void AddUploadedFile(const FilePath& virtual_dir_path, 530 virtual void AddUploadedFile(const FilePath& virtual_dir_path,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 647
655 // Callback run as a response to LoadFeedFromServer. 648 // Callback run as a response to LoadFeedFromServer.
656 typedef base::Callback<void(GetDocumentsParams* params, 649 typedef base::Callback<void(GetDocumentsParams* params,
657 base::PlatformFileError error)> 650 base::PlatformFileError error)>
658 LoadDocumentFeedCallback; 651 LoadDocumentFeedCallback;
659 652
660 // Finds entry object by |file_path| and returns the entry object. 653 // Finds entry object by |file_path| and returns the entry object.
661 // Returns NULL if it does not find the entry. 654 // Returns NULL if it does not find the entry.
662 GDataEntry* GetGDataEntryByPath(const FilePath& file_path); 655 GDataEntry* GetGDataEntryByPath(const FilePath& file_path);
663 656
664 // Inits cache directory paths in the provided root.
665 // Should be called before cache is initialized.
666 void SetCachePaths(const FilePath& root_path);
667
668 // Converts document feed from gdata service into DirectoryInfo. On failure, 657 // Converts document feed from gdata service into DirectoryInfo. On failure,
669 // returns NULL and fills in |error| with an appropriate value. 658 // returns NULL and fills in |error| with an appropriate value.
670 GDataDirectory* ParseGDataFeed(GDataErrorCode status, 659 GDataDirectory* ParseGDataFeed(GDataErrorCode status,
671 base::Value* data, 660 base::Value* data,
672 base::PlatformFileError *error); 661 base::PlatformFileError *error);
673 662
674 // Callback passed to |LoadFeedFromServer| from |SearchAsync| method. 663 // Callback passed to |LoadFeedFromServer| from |SearchAsync| method.
675 // |callback| is that should be run with data received from 664 // |callback| is that should be run with data received from
676 // |LoadFeedFromServer|. 665 // |LoadFeedFromServer|.
677 // |params| params used for getting document feed for content search. 666 // |params| params used for getting document feed for content search.
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 1480
1492 // The profile hosts the GDataFileSystem via GDataSystemService. 1481 // The profile hosts the GDataFileSystem via GDataSystemService.
1493 Profile* profile_; 1482 Profile* profile_;
1494 1483
1495 // The document service for the GDataFileSystem. 1484 // The document service for the GDataFileSystem.
1496 DocumentsServiceInterface* documents_service_; 1485 DocumentsServiceInterface* documents_service_;
1497 1486
1498 // Base path for GData cache, e.g. <user_profile_dir>/user/GCache/v1. 1487 // Base path for GData cache, e.g. <user_profile_dir>/user/GCache/v1.
1499 FilePath gdata_cache_path_; 1488 FilePath gdata_cache_path_;
1500 1489
1501 // Paths for all subdirectories of GCache, one for each
1502 // GDataCache::CacheSubDirectoryType enum.
1503 std::vector<FilePath> cache_paths_;
1504
1505 // Waitable events used to block destructor until all the tasks on blocking 1490 // Waitable events used to block destructor until all the tasks on blocking
1506 // pool are run. 1491 // pool are run.
1507 scoped_ptr<base::WaitableEvent> on_io_completed_; 1492 scoped_ptr<base::WaitableEvent> on_io_completed_;
1508 1493
1509 // True if cache initialization has started, is in progress or has completed, 1494 // True if cache initialization has started, is in progress or has completed,
1510 // we only want to initialize cache once. 1495 // we only want to initialize cache once.
1511 bool cache_initialization_started_; 1496 bool cache_initialization_started_;
1512 1497
1513 // Number of pending tasks on the blocking pool. 1498 // Number of pending tasks on the blocking pool.
1514 int num_pending_tasks_; 1499 int num_pending_tasks_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 }; 1533 };
1549 1534
1550 // Sets the free disk space getter for testing. 1535 // Sets the free disk space getter for testing.
1551 // The existing getter is deleted. 1536 // The existing getter is deleted.
1552 void SetFreeDiskSpaceGetterForTesting( 1537 void SetFreeDiskSpaceGetterForTesting(
1553 FreeDiskSpaceGetterInterface* getter); 1538 FreeDiskSpaceGetterInterface* getter);
1554 1539
1555 } // namespace gdata 1540 } // namespace gdata
1556 1541
1557 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 1542 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698