Index: chrome/browser/chromeos/gdata/gdata_file_system.h |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h |
index c963adc4545962b8d62a31b362e30ad0933a11fc..81514fbe567f85289f581e57c123dddccf3baef8 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system.h |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.h |
@@ -18,6 +18,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop.h" |
#include "base/platform_file.h" |
+#include "base/timer.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/sequenced_worker_pool.h" |
#include "chrome/browser/chromeos/gdata/find_entry_delegate.h" |
@@ -175,6 +176,15 @@ class GDataFileSystemInterface { |
virtual void AddObserver(Observer* observer) = 0; |
virtual void RemoveObserver(Observer* observer) = 0; |
+ // Requests to start periodic updates. |
+ // This function only starts periodic updates if it is not yet started. |
+ virtual void RequestStartUpdates() = 0; |
+ |
+ // Requests to stop periodic updates. |
+ // This function only stops periodic updates if the number of outstanding |
+ // update requests reaches zero. |
+ virtual void RequestStopUpdates() = 0; |
+ |
// Enum defining origin of a cached file. |
enum CachedFileOrigin { |
CACHED_FILE_FROM_SERVER = 0, |
@@ -400,6 +410,8 @@ class GDataFileSystem : public GDataFileSystemInterface, |
virtual void Initialize() OVERRIDE; |
virtual void AddObserver(Observer* observer) OVERRIDE; |
virtual void RemoveObserver(Observer* observer) OVERRIDE; |
+ virtual void RequestStartUpdates() OVERRIDE; |
+ virtual void RequestStopUpdates() OVERRIDE; |
virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
virtual void FindEntryByResourceIdSync(const std::string& resource_id, |
FindEntryDelegate* delegate) OVERRIDE; |
@@ -1303,6 +1315,9 @@ class GDataFileSystem : public GDataFileSystemInterface, |
bool to_mount, |
const SetMountedStateCallback& callback); |
+ // Checks for updates on the server. |
+ void CheckForUpdates(); |
+ |
scoped_ptr<GDataRootDirectory> root_; |
// This guards regular states. |
@@ -1333,6 +1348,12 @@ class GDataFileSystem : public GDataFileSystemInterface, |
int num_pending_tasks_; |
base::Lock num_pending_tasks_lock_; |
+ // Number of active update requests. |
+ int num_update_requests_; |
+ |
+ // Periodic timer for checking updates. |
+ base::Timer update_timer_; |
+ |
// True if hosted documents should be hidden. |
bool hide_hosted_docs_; |