| OLD | NEW |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // check if the download is ready to complete. | 47 // check if the download is ready to complete. |
| 48 static bool IsReadyToComplete(content::DownloadItem* download); | 48 static bool IsReadyToComplete(content::DownloadItem* download); |
| 49 | 49 |
| 50 // Returns the count of bytes confirmed as uploaded so far for |download|. | 50 // Returns the count of bytes confirmed as uploaded so far for |download|. |
| 51 static int64 GetUploadedBytes(content::DownloadItem* download); | 51 static int64 GetUploadedBytes(content::DownloadItem* download); |
| 52 | 52 |
| 53 // Returns the progress of the upload of |download| as a percentage. If the | 53 // Returns the progress of the upload of |download| as a percentage. If the |
| 54 // progress is unknown, returns -1. | 54 // progress is unknown, returns -1. |
| 55 static int PercentComplete(content::DownloadItem* download); | 55 static int PercentComplete(content::DownloadItem* download); |
| 56 | 56 |
| 57 // Create a temporary file |gdata_tmp_download_path| in |
| 58 // |gdata_tmp_download_dir|. Must be called on a thread that allows file |
| 59 // operations. |
| 60 static void GetGDataTempDownloadPath(const FilePath& gdata_tmp_download_dir, |
| 61 FilePath* gdata_tmp_download_path); |
| 62 |
| 57 private: | 63 private: |
| 58 // Gets the gdata_path from external data in |download|. | 64 // Gets the gdata_path from external data in |download|. |
| 59 // GetGDataPath may return an empty path in case SetGDataPath was not | 65 // GetGDataPath may return an empty path in case SetGDataPath was not |
| 60 // previously called or there was some other internal error | 66 // previously called or there was some other internal error |
| 61 // (there is a DCHECK for this). | 67 // (there is a DCHECK for this). |
| 62 static FilePath GetGDataPath(content::DownloadItem* download); | 68 static FilePath GetGDataPath(content::DownloadItem* download); |
| 63 | 69 |
| 64 // DownloadManager overrides. | 70 // DownloadManager overrides. |
| 65 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; | 71 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; |
| 66 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE; | 72 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 115 |
| 110 // Temporary download location directory. | 116 // Temporary download location directory. |
| 111 FilePath temp_download_path_; | 117 FilePath temp_download_path_; |
| 112 | 118 |
| 113 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver); | 119 DISALLOW_COPY_AND_ASSIGN(GDataDownloadObserver); |
| 114 }; | 120 }; |
| 115 | 121 |
| 116 } // namespace gdata | 122 } // namespace gdata |
| 117 | 123 |
| 118 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__ | 124 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DOWNLOAD_OBSERVER_H__ |
| OLD | NEW |