| 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" | |
| 23 #include "chrome/browser/chromeos/gdata/gdata_params.h" | 22 #include "chrome/browser/chromeos/gdata/gdata_params.h" |
| 24 #include "chrome/browser/chromeos/gdata/gdata_parser.h" | 23 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
| 25 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 24 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 26 #include "chrome/browser/profiles/profile_keyed_service.h" | 25 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 27 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 26 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| 30 class WaitableEvent; | 29 class WaitableEvent; |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 235 |
| 237 // Gets the cache state of file corresponding to |resource_id| and |md5| if it | 236 // Gets the cache state of file corresponding to |resource_id| and |md5| if it |
| 238 // exists on disk. | 237 // exists on disk. |
| 239 // Initializes cache if it has not been initialized. | 238 // Initializes cache if it has not been initialized. |
| 240 // Upon completion, |callback| is invoked on the thread where this method was | 239 // 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 | 240 // called with the cache state if file exists in cache or CACHE_STATE_NONE |
| 242 // otherwise. | 241 // otherwise. |
| 243 void GetCacheState(const std::string& resource_id, | 242 void GetCacheState(const std::string& resource_id, |
| 244 const std::string& md5, | 243 const std::string& md5, |
| 245 const GetCacheStateCallback& callback); | 244 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 | 245 |
| 253 // Finds file object by |file_path| and returns its |file_info|. | 246 // Finds file object by |file_path| and returns its |file_info|. |
| 254 // Returns true if file was found. | 247 // Returns true if file was found. |
| 255 bool GetFileInfoFromPath(const FilePath& gdata_file_path, | 248 bool GetFileInfoFromPath(const FilePath& gdata_file_path, |
| 256 base::PlatformFileInfo* file_info); | 249 base::PlatformFileInfo* file_info); |
| 257 | 250 |
| 258 // Returns the tmp sub-directory under gdata cache directory, i.e. | 251 // Returns the tmp sub-directory under gdata cache directory, i.e. |
| 259 // <user_profile_dir>/GCache/v1/tmp | 252 // <user_profile_dir>/GCache/v1/tmp |
| 260 FilePath GetGDataCacheTmpDirectory() { | 253 FilePath GetGDataCacheTmpDirectory() { |
| 261 return cache_paths_[CACHE_TYPE_TMP]; | 254 return cache_paths_[CACHE_TYPE_TMP]; |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 virtual void OnError(base::PlatformFileError) OVERRIDE; | 765 virtual void OnError(base::PlatformFileError) OVERRIDE; |
| 773 virtual bool had_terminated() const OVERRIDE; | 766 virtual bool had_terminated() const OVERRIDE; |
| 774 | 767 |
| 775 // File entry that was found. | 768 // File entry that was found. |
| 776 GDataFileBase* file_; | 769 GDataFileBase* file_; |
| 777 }; | 770 }; |
| 778 | 771 |
| 779 } // namespace gdata | 772 } // namespace gdata |
| 780 | 773 |
| 781 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 774 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |