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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_download_observer.h

Issue 10263019: DownloadManagerDelegate::ShouldCompleteDownload(callback) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: complete_callback is the droids you're looking for. Created 8 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_DOWNLOAD_OBSERVER_H__ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 26 matching lines...) Expand all
37 // to external data in |download|. 37 // to external data in |download|.
38 static void SetGDataPath(content::DownloadItem* download, 38 static void SetGDataPath(content::DownloadItem* download,
39 const FilePath& gdata_path); 39 const FilePath& gdata_path);
40 40
41 // Checks if there is a GData upload associated with |download| 41 // Checks if there is a GData upload associated with |download|
42 static bool IsGDataDownload(content::DownloadItem* download); 42 static bool IsGDataDownload(content::DownloadItem* download);
43 43
44 // Checks if |download| is ready to complete. Returns true if |download| has 44 // Checks if |download| is ready to complete. Returns true if |download| has
45 // no GData upload associated with it or if the GData upload has already 45 // no GData upload associated with it or if the GData upload has already
46 // completed. This method is called by the ChromeDownloadManagerDelegate to 46 // completed. This method is called by the ChromeDownloadManagerDelegate to
47 // check if the download is ready to complete. 47 // check if the download is ready to complete. If the download is not yet
48 static bool IsReadyToComplete(content::DownloadItem* download); 48 // ready to complete and |complete_callback| is not null, then
49 // |complete_callback| will be called on the UI thread when the download
50 // becomes ready to complete. If this call is made multiple times with the
51 // download not ready to complete, only one callback will be generated, to the
52 // last non-null value passed as complete_callback. You can't unset it once
53 // you set it, except to reset it to another non-null callback.
54 static bool IsReadyToComplete(
55 content::DownloadItem* download,
56 const base::Closure& complete_callback);
49 57
50 // Returns the count of bytes confirmed as uploaded so far for |download|. 58 // Returns the count of bytes confirmed as uploaded so far for |download|.
51 static int64 GetUploadedBytes(content::DownloadItem* download); 59 static int64 GetUploadedBytes(content::DownloadItem* download);
52 60
53 // Returns the progress of the upload of |download| as a percentage. If the 61 // Returns the progress of the upload of |download| as a percentage. If the
54 // progress is unknown, returns -1. 62 // progress is unknown, returns -1.
55 static int PercentComplete(content::DownloadItem* download); 63 static int PercentComplete(content::DownloadItem* download);
56 64
57 // Create a temporary file |gdata_tmp_download_path| in 65 // Create a temporary file |gdata_tmp_download_path| in
58 // |gdata_tmp_download_dir|. Must be called on a thread that allows file 66 // |gdata_tmp_download_dir|. Must be called on a thread that allows file
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 DownloadMap pending_downloads_; 126 DownloadMap pending_downloads_;
119 127
120 base::WeakPtrFactory<GDataDownloadObserver> weak_ptr_factory_; 128 base::WeakPtrFactory<GDataDownloadObserver> weak_ptr_factory_;
121 129
122 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver); 130 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver);
123 }; 131 };
124 132
125 } // namespace gdata 133 } // namespace gdata
126 134
127 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__ 135 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698