| 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 | 7 |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/platform_file.h" | 19 #include "base/platform_file.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 21 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
| 22 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
| 22 #include "chrome/browser/chromeos/gdata/gdata_params.h" | 23 #include "chrome/browser/chromeos/gdata/gdata_params.h" |
| 23 #include "chrome/browser/chromeos/gdata/gdata_parser.h" | 24 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
| 24 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 25 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 25 #include "chrome/browser/profiles/profile_keyed_service.h" | 26 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 26 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 27 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| 29 class WaitableEvent; | 30 class WaitableEvent; |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Can be called from any thread. | 227 // Can be called from any thread. |
| 227 void RefreshDirectoryAndContinueSearch(const FindFileParams& params); | 228 void RefreshDirectoryAndContinueSearch(const FindFileParams& params); |
| 228 | 229 |
| 229 // Gets absolute path of cache file corresponding to |gdata_file_path|. | 230 // Gets absolute path of cache file corresponding to |gdata_file_path|. |
| 230 // Upon completion, |callback| is invoked on the same thread where this method | 231 // Upon completion, |callback| is invoked on the same thread where this method |
| 231 // was called, with path if it exists and is accessible or empty FilePath | 232 // was called, with path if it exists and is accessible or empty FilePath |
| 232 // otherwise. | 233 // otherwise. |
| 233 void GetFromCacheForPath(const FilePath& gdata_file_path, | 234 void GetFromCacheForPath(const FilePath& gdata_file_path, |
| 234 const GetFromCacheCallback& callback); | 235 const GetFromCacheCallback& callback); |
| 235 | 236 |
| 237 // Gets the cache state of file corresponding to |resource_id| and |md5| if it |
| 238 // exists on disk. |
| 239 // Initializes cache if it has not been initialized. |
| 240 // Upon completion, |callback| is invoked on the thread where this method was |
| 241 // called with the cache state if file exists in cache or CACHE_STATE_NONE |
| 242 // otherwise. |
| 243 void GetCacheState(const std::string& resource_id, |
| 244 const std::string& md5, |
| 245 const GetCacheStateCallback& callback); |
| 246 // Obtains the list of currently active operations. |
| 247 std::vector<GDataOperationRegistry::ProgressStatus> GetProgressStatusList(); |
| 248 // Add operation observer. |
| 249 void AddOperationObserver(GDataOperationRegistry::Observer* observer); |
| 250 // Remove operation observer. |
| 251 void RemoveOperationObserver(GDataOperationRegistry::Observer* observer); |
| 252 |
| 236 // Finds file object by |file_path| and returns its |file_info|. | 253 // Finds file object by |file_path| and returns its |file_info|. |
| 237 // Returns true if file was found. | 254 // Returns true if file was found. |
| 238 bool GetFileInfoFromPath(const FilePath& gdata_file_path, | 255 bool GetFileInfoFromPath(const FilePath& gdata_file_path, |
| 239 base::PlatformFileInfo* file_info); | 256 base::PlatformFileInfo* file_info); |
| 240 | 257 |
| 241 // Returns the tmp sub-directory under gdata cache directory, i.e. | 258 // Returns the tmp sub-directory under gdata cache directory, i.e. |
| 242 // <user_profile_dir>/GCache/v1/tmp | 259 // <user_profile_dir>/GCache/v1/tmp |
| 243 FilePath GetGDataCacheTmpDirectory() { | 260 FilePath GetGDataCacheTmpDirectory() { |
| 244 return cache_paths_[CACHE_TYPE_TMP]; | 261 return cache_paths_[CACHE_TYPE_TMP]; |
| 245 } | 262 } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 virtual void OnError(base::PlatformFileError) OVERRIDE; | 766 virtual void OnError(base::PlatformFileError) OVERRIDE; |
| 750 virtual bool had_terminated() const OVERRIDE; | 767 virtual bool had_terminated() const OVERRIDE; |
| 751 | 768 |
| 752 // File entry that was found. | 769 // File entry that was found. |
| 753 GDataFileBase* file_; | 770 GDataFileBase* file_; |
| 754 }; | 771 }; |
| 755 | 772 |
| 756 } // namespace gdata | 773 } // namespace gdata |
| 757 | 774 |
| 758 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 775 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |