Index: chrome/browser/chromeos/drive/download_handler.h |
diff --git a/chrome/browser/chromeos/drive/download_handler.h b/chrome/browser/chromeos/drive/download_handler.h |
index 9973224c1b5c5fad0aa60af49d60f97ce55ee510..c0f36d1ed9552be209042398be617026e7f56e1f 100644 |
--- a/chrome/browser/chromeos/drive/download_handler.h |
+++ b/chrome/browser/chromeos/drive/download_handler.h |
@@ -73,6 +73,21 @@ class DownloadHandler : public AllDownloadItemNotifier::Observer { |
const content::DownloadItem* download, |
const content::CheckForFileExistenceCallback& callback); |
+ // Calculates request space for |downloads|. |
+ int64 CalculateRequestSpace( |
+ const content::DownloadManager::DownloadVector& downloads); |
+ |
+ // Checks available storage space and free disk space if necessary. Actual |
+ // execution is delayed and rate limited. |
+ void FreeDiskSpaceIfNeeded(); |
+ |
+ // Checks available storage space and free disk space if necessary. This is |
+ // executed immediately. |
+ void FreeDiskSpaceIfNeededImmediately(); |
+ |
+ // Sets free disk space delay for testing. |
+ void SetFreeDiskSpaceDelayForTesting(const base::TimeDelta& delay); |
+ |
private: |
// AllDownloadItemNotifier::Observer overrides: |
void OnDownloadCreated(content::DownloadManager* manager, |
@@ -104,6 +119,7 @@ class DownloadHandler : public AllDownloadItemNotifier::Observer { |
content::DownloadManager* GetDownloadManager(void* manager_id); |
FileSystemInterface* file_system_; // Owned by DriveIntegrationService. |
+ |
// Observe the DownloadManager for new downloads. |
scoped_ptr<AllDownloadItemNotifier> notifier_; |
scoped_ptr<AllDownloadItemNotifier> notifier_incognito_; |
@@ -111,6 +127,11 @@ class DownloadHandler : public AllDownloadItemNotifier::Observer { |
// Temporary download location directory. |
base::FilePath drive_tmp_download_path_; |
+ // True if there is pending FreeDiskSpaceIfNeeded call. |
+ bool has_pending_free_disk_space_; |
+ |
+ base::TimeDelta free_disk_space_delay_; |
+ |
// Note: This should remain the last member so it'll be destroyed and |
// invalidate its weak pointers before any other members are destroyed. |
base::WeakPtrFactory<DownloadHandler> weak_ptr_factory_; |