Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: chrome/browser/chromeos/drive/download_handler.h

Issue 1414753005: Evict drive cache with file download from website if necessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/download_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/download_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698