| OLD | NEW |
| 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 base::PlatformFileError AddNewDirectory(const FilePath& directory_path, | 901 base::PlatformFileError AddNewDirectory(const FilePath& directory_path, |
| 902 base::Value* entry_value); | 902 base::Value* entry_value); |
| 903 | 903 |
| 904 // Given non-existing |directory_path|, finds the first missing parent | 904 // Given non-existing |directory_path|, finds the first missing parent |
| 905 // directory of |directory_path|. | 905 // directory of |directory_path|. |
| 906 FindMissingDirectoryResult FindFirstMissingParentDirectory( | 906 FindMissingDirectoryResult FindFirstMissingParentDirectory( |
| 907 const FilePath& directory_path, | 907 const FilePath& directory_path, |
| 908 GURL* last_dir_content_url, | 908 GURL* last_dir_content_url, |
| 909 FilePath* first_missing_parent_path); | 909 FilePath* first_missing_parent_path); |
| 910 | 910 |
| 911 // Retreives account metadata and determines from the last change timestamp | 911 // Retrieves account metadata and determines from the last change timestamp |
| 912 // if the feed content loading from the server needs to be initiated. | 912 // if the feed content loading from the server needs to be initiated. |
| 913 void ReloadFeedFromServerIfNeeded(ContentOrigin initial_origin, | 913 void ReloadFeedFromServerIfNeeded(ContentOrigin initial_origin, |
| 914 int local_changestamp, | 914 int local_changestamp, |
| 915 const FilePath& search_file_path, | 915 const FilePath& search_file_path, |
| 916 const FindEntryCallback& callback); | 916 const FindEntryCallback& callback); |
| 917 | 917 |
| 918 // Helper callback for handling results of metadata retrieval initiated from | 918 // Helper callback for handling results of metadata retrieval initiated from |
| 919 // ReloadFeedFromServerIfNeeded(). This method makes a decision about fetching | 919 // ReloadFeedFromServerIfNeeded(). This method makes a decision about fetching |
| 920 // the content of the root feed during the root directory refresh process. | 920 // the content of the root feed during the root directory refresh process. |
| 921 void OnGetAccountMetadata(ContentOrigin initial_origin, | 921 void OnGetAccountMetadata(ContentOrigin initial_origin, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated | 959 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated |
| 960 // from CheckForUpdates(). This callback checks whether feed is successfully | 960 // from CheckForUpdates(). This callback checks whether feed is successfully |
| 961 // reloaded, and in case of failure, restores the content origin of the root | 961 // reloaded, and in case of failure, restores the content origin of the root |
| 962 // directory. | 962 // directory. |
| 963 void OnUpdateChecked(ContentOrigin initial_origin, | 963 void OnUpdateChecked(ContentOrigin initial_origin, |
| 964 base::PlatformFileError error, | 964 base::PlatformFileError error, |
| 965 GDataEntry* entry); | 965 GDataEntry* entry); |
| 966 | 966 |
| 967 // Starts root feed load from the cache. If successful, it will try to find | 967 // Starts root feed load from the cache. If successful, it will try to find |
| 968 // the file upon retrieval completion. In addition to that, it will | 968 // the file upon retrieval completion. In addition to that, it will |
| 969 // initate retrieval of the root feed from the server if | 969 // initiate retrieval of the root feed from the server if |
| 970 // |should_load_from_server| is set. | 970 // |should_load_from_server| is set. |
| 971 void LoadRootFeedFromCache(bool should_load_from_server, | 971 void LoadRootFeedFromCache(bool should_load_from_server, |
| 972 const FilePath& search_file_path, | 972 const FilePath& search_file_path, |
| 973 const FindEntryCallback& callback); | 973 const FindEntryCallback& callback); |
| 974 | 974 |
| 975 // Callback for handling root directory refresh from the cache. | 975 // Callback for handling root directory refresh from the cache. |
| 976 void OnProtoLoaded(LoadRootFeedParams* params); | 976 void OnProtoLoaded(LoadRootFeedParams* params); |
| 977 | 977 |
| 978 // Save filesystem as proto file. | 978 // Save filesystem as proto file. |
| 979 void SaveFileSystemAsProto(); | 979 void SaveFileSystemAsProto(); |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 // The document service for the GDataFileSystem. | 1428 // The document service for the GDataFileSystem. |
| 1429 DocumentsServiceInterface* documents_service_; | 1429 DocumentsServiceInterface* documents_service_; |
| 1430 | 1430 |
| 1431 // Base path for GData cache, e.g. <user_profile_dir>/user/GCache/v1. | 1431 // Base path for GData cache, e.g. <user_profile_dir>/user/GCache/v1. |
| 1432 FilePath gdata_cache_path_; | 1432 FilePath gdata_cache_path_; |
| 1433 | 1433 |
| 1434 // Paths for all subdirectories of GCache, one for each | 1434 // Paths for all subdirectories of GCache, one for each |
| 1435 // GDataCache::CacheSubDirectoryType enum. | 1435 // GDataCache::CacheSubDirectoryType enum. |
| 1436 std::vector<FilePath> cache_paths_; | 1436 std::vector<FilePath> cache_paths_; |
| 1437 | 1437 |
| 1438 // Waitable events used to block dectructor until all the tasks on blocking | 1438 // Waitable events used to block destructor until all the tasks on blocking |
| 1439 // thread pool are run. | 1439 // thread pool are run. |
| 1440 scoped_ptr<base::WaitableEvent> on_io_completed_; | 1440 scoped_ptr<base::WaitableEvent> on_io_completed_; |
| 1441 | 1441 |
| 1442 // True if cache initialization has started, is in progress or has completed, | 1442 // True if cache initialization has started, is in progress or has completed, |
| 1443 // we only want to initialize cache once. | 1443 // we only want to initialize cache once. |
| 1444 bool cache_initialization_started_; | 1444 bool cache_initialization_started_; |
| 1445 | 1445 |
| 1446 // Number of pending tasks on the blocking thread pool. | 1446 // Number of pending tasks on the blocking thread pool. |
| 1447 int num_pending_tasks_; | 1447 int num_pending_tasks_; |
| 1448 base::Lock num_pending_tasks_lock_; | 1448 base::Lock num_pending_tasks_lock_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 }; | 1481 }; |
| 1482 | 1482 |
| 1483 // Sets the free disk space getter for testing. | 1483 // Sets the free disk space getter for testing. |
| 1484 // The existing getter is deleted. | 1484 // The existing getter is deleted. |
| 1485 void SetFreeDiskSpaceGetterForTesting( | 1485 void SetFreeDiskSpaceGetterForTesting( |
| 1486 FreeDiskSpaceGetterInterface* getter); | 1486 FreeDiskSpaceGetterInterface* getter); |
| 1487 | 1487 |
| 1488 } // namespace gdata | 1488 } // namespace gdata |
| 1489 | 1489 |
| 1490 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1490 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |