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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
20 #include "chrome/browser/chromeos/gdata/find_entry_callback.h" | |
21 #include "chrome/browser/chromeos/gdata/gdata_cache.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_cache.h" |
22 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 21 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
23 #include "chrome/browser/prefs/pref_change_registrar.h" | 22 #include "chrome/browser/prefs/pref_change_registrar.h" |
24 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
25 | 24 |
26 namespace base { | 25 namespace base { |
27 class WaitableEvent; | 26 class WaitableEvent; |
28 } | 27 } |
29 | 28 |
30 namespace gdata { | 29 namespace gdata { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 }; | 175 }; |
177 | 176 |
178 // Authenticates the user by fetching the auth token as | 177 // Authenticates the user by fetching the auth token as |
179 // needed. |callback| will be run with the error code and the auth | 178 // needed. |callback| will be run with the error code and the auth |
180 // token, on the thread this function is run. | 179 // token, on the thread this function is run. |
181 // | 180 // |
182 // Must be called on UI thread. | 181 // Must be called on UI thread. |
183 virtual void Authenticate(const AuthStatusCallback& callback) = 0; | 182 virtual void Authenticate(const AuthStatusCallback& callback) = 0; |
184 | 183 |
185 // Finds file info by using |resource_id|. This call does not initiate | 184 // Finds file info by using |resource_id|. This call does not initiate |
186 // content refreshing and will invoke one of |callback| methods directly as | 185 // content refreshing. |
187 // it executes. | |
188 // | 186 // |
189 // Can be called from UI/IO thread. |callback| is run on the calling thread | 187 // Can be called from UI/IO thread. |callback| is run on the calling thread. |
190 // synchronously. | 188 virtual void FindEntryByResourceId(const std::string& resource_id, |
191 virtual void FindEntryByResourceIdSync(const std::string& resource_id, | 189 const FindEntryCallback& callback) = 0; |
192 const FindEntryCallback& callback) = 0; | |
193 | 190 |
194 // Initiates transfer of |remote_src_file_path| to |local_dest_file_path|. | 191 // Initiates transfer of |remote_src_file_path| to |local_dest_file_path|. |
195 // |remote_src_file_path| is the virtual source path on the gdata file system. | 192 // |remote_src_file_path| is the virtual source path on the gdata file system. |
196 // |local_dest_file_path| is the destination path on the local file system. | 193 // |local_dest_file_path| is the destination path on the local file system. |
197 // | 194 // |
198 // Must be called from *UI* thread. |callback| is run on the calling thread. | 195 // Must be called from *UI* thread. |callback| is run on the calling thread. |
199 virtual void TransferFileFromRemoteToLocal( | 196 virtual void TransferFileFromRemoteToLocal( |
200 const FilePath& remote_src_file_path, | 197 const FilePath& remote_src_file_path, |
201 const FilePath& local_dest_file_path, | 198 const FilePath& local_dest_file_path, |
202 const FileOperationCallback& callback) = 0; | 199 const FileOperationCallback& callback) = 0; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 virtual ~GDataFileSystem(); | 411 virtual ~GDataFileSystem(); |
415 | 412 |
416 // GDataFileSystem overrides. | 413 // GDataFileSystem overrides. |
417 virtual void Initialize() OVERRIDE; | 414 virtual void Initialize() OVERRIDE; |
418 virtual void AddObserver(Observer* observer) OVERRIDE; | 415 virtual void AddObserver(Observer* observer) OVERRIDE; |
419 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 416 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
420 virtual void StartUpdates() OVERRIDE; | 417 virtual void StartUpdates() OVERRIDE; |
421 virtual void StopUpdates() OVERRIDE; | 418 virtual void StopUpdates() OVERRIDE; |
422 virtual void CheckForUpdates() OVERRIDE; | 419 virtual void CheckForUpdates() OVERRIDE; |
423 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; | 420 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
424 virtual void FindEntryByResourceIdSync( | 421 virtual void FindEntryByResourceId( |
425 const std::string& resource_id, | 422 const std::string& resource_id, |
426 const FindEntryCallback& callback) OVERRIDE; | 423 const FindEntryCallback& callback) OVERRIDE; |
427 virtual void SearchAsync(const std::string& search_query, | 424 virtual void SearchAsync(const std::string& search_query, |
428 const ReadDirectoryCallback& callback) OVERRIDE; | 425 const ReadDirectoryCallback& callback) OVERRIDE; |
429 virtual void TransferFileFromRemoteToLocal( | 426 virtual void TransferFileFromRemoteToLocal( |
430 const FilePath& remote_src_file_path, | 427 const FilePath& remote_src_file_path, |
431 const FilePath& local_dest_file_path, | 428 const FilePath& local_dest_file_path, |
432 const FileOperationCallback& callback) OVERRIDE; | 429 const FileOperationCallback& callback) OVERRIDE; |
433 virtual void TransferFileFromLocalToRemote( | 430 virtual void TransferFileFromLocalToRemote( |
434 const FilePath& local_src_file_path, | 431 const FilePath& local_src_file_path, |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 void GetFileByResourceIdOnUIThread( | 1422 void GetFileByResourceIdOnUIThread( |
1426 const std::string& resource_id, | 1423 const std::string& resource_id, |
1427 const GetFileCallback& get_file_callback, | 1424 const GetFileCallback& get_file_callback, |
1428 const GetDownloadDataCallback& get_download_data_callback); | 1425 const GetDownloadDataCallback& get_download_data_callback); |
1429 void GetEntryInfoByPathAsyncOnUIThread( | 1426 void GetEntryInfoByPathAsyncOnUIThread( |
1430 const FilePath& file_path, | 1427 const FilePath& file_path, |
1431 const GetEntryInfoCallback& callback); | 1428 const GetEntryInfoCallback& callback); |
1432 void GetFileInfoByPathAsyncOnUIThread( | 1429 void GetFileInfoByPathAsyncOnUIThread( |
1433 const FilePath& file_path, | 1430 const FilePath& file_path, |
1434 const GetFileInfoCallback& callback); | 1431 const GetFileInfoCallback& callback); |
| 1432 void FindEntryByResourceIdOnUIThread(const std::string& resource_id, |
| 1433 const FindEntryCallback& callback); |
1435 void ReadDirectoryByPathAsyncOnUIThread( | 1434 void ReadDirectoryByPathAsyncOnUIThread( |
1436 const FilePath& file_path, | 1435 const FilePath& file_path, |
1437 const ReadDirectoryCallback& callback); | 1436 const ReadDirectoryCallback& callback); |
1438 void RequestDirectoryRefreshOnUIThread( | 1437 void RequestDirectoryRefreshOnUIThread( |
1439 const FilePath& file_path); | 1438 const FilePath& file_path); |
1440 void OnRequestDirectoryRefresh(GetDocumentsParams* params, | 1439 void OnRequestDirectoryRefresh(GetDocumentsParams* params, |
1441 base::PlatformFileError error); | 1440 base::PlatformFileError error); |
1442 void GetCacheStateOnUIThread(const std::string& resource_id, | 1441 void GetCacheStateOnUIThread(const std::string& resource_id, |
1443 const std::string& md5, | 1442 const std::string& md5, |
1444 const GetCacheStateCallback& callback); | 1443 const GetCacheStateCallback& callback); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 }; | 1509 }; |
1511 | 1510 |
1512 // Sets the free disk space getter for testing. | 1511 // Sets the free disk space getter for testing. |
1513 // The existing getter is deleted. | 1512 // The existing getter is deleted. |
1514 void SetFreeDiskSpaceGetterForTesting( | 1513 void SetFreeDiskSpaceGetterForTesting( |
1515 FreeDiskSpaceGetterInterface* getter); | 1514 FreeDiskSpaceGetterInterface* getter); |
1516 | 1515 |
1517 } // namespace gdata | 1516 } // namespace gdata |
1518 | 1517 |
1519 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1518 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |