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

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: comments 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_download_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 |maybe_complete_download| is not null, then
49 // |maybe_complete_download| will be called on the UI thread when the download
50 // becomes ready to complete. If you aren't careful to avoid setting
Randy Smith (Not in Mondays) 2012/05/01 18:21:49 I'd actually just say "If this call is made multip
benjhayden 2012/05/01 19:00:30 Done.
51 // |maybe_complete_download| twice, then the last one wins. You can't unset
52 // it once you set it.
53 static bool IsReadyToComplete(
54 content::DownloadItem* download,
55 const base::Closure& maybe_complete_download);
49 56
50 // Returns the count of bytes confirmed as uploaded so far for |download|. 57 // Returns the count of bytes confirmed as uploaded so far for |download|.
51 static int64 GetUploadedBytes(content::DownloadItem* download); 58 static int64 GetUploadedBytes(content::DownloadItem* download);
52 59
53 // Returns the progress of the upload of |download| as a percentage. If the 60 // Returns the progress of the upload of |download| as a percentage. If the
54 // progress is unknown, returns -1. 61 // progress is unknown, returns -1.
55 static int PercentComplete(content::DownloadItem* download); 62 static int PercentComplete(content::DownloadItem* download);
56 63
57 // Create a temporary file |gdata_tmp_download_path| in 64 // Create a temporary file |gdata_tmp_download_path| in
58 // |gdata_tmp_download_dir|. Must be called on a thread that allows file 65 // |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_; 125 DownloadMap pending_downloads_;
119 126
120 base::WeakPtrFactory<GDataDownloadObserver> weak_ptr_factory_; 127 base::WeakPtrFactory<GDataDownloadObserver> weak_ptr_factory_;
121 128
122 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver); 129 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver);
123 }; 130 };
124 131
125 } // namespace gdata 132 } // namespace gdata
126 133
127 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__ 134 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_download_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698