| 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 CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "content/browser/download/save_types.h" | 10 #include "content/browser/download/save_types.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Saving operation completed. | 43 // Saving operation completed. |
| 44 void Finish(int64 size, bool is_success); | 44 void Finish(int64 size, bool is_success); |
| 45 | 45 |
| 46 // Rough percent complete, -1 means we don't know (since we didn't receive a | 46 // Rough percent complete, -1 means we don't know (since we didn't receive a |
| 47 // total size). | 47 // total size). |
| 48 int PercentComplete() const; | 48 int PercentComplete() const; |
| 49 | 49 |
| 50 // Update path for SaveItem, the actual file is renamed on the file thread. | 50 // Update path for SaveItem, the actual file is renamed on the file thread. |
| 51 void Rename(const base::FilePath& full_path); | 51 void Rename(const base::FilePath& full_path); |
| 52 | 52 |
| 53 void SetSaveId(int32 save_id); | |
| 54 | |
| 55 void SetTotalBytes(int64 total_bytes); | 53 void SetTotalBytes(int64 total_bytes); |
| 56 | 54 |
| 57 // Accessors. | 55 // Accessors. |
| 56 int id() const { return save_item_id_; } |
| 58 SaveState state() const { return state_; } | 57 SaveState state() const { return state_; } |
| 59 const base::FilePath& full_path() const { return full_path_; } | 58 const base::FilePath& full_path() const { return full_path_; } |
| 60 const base::FilePath& file_name() const { return file_name_; } | 59 const base::FilePath& file_name() const { return file_name_; } |
| 61 const GURL& url() const { return url_; } | 60 const GURL& url() const { return url_; } |
| 62 const Referrer& referrer() const { return referrer_; } | 61 const Referrer& referrer() const { return referrer_; } |
| 63 int64 total_bytes() const { return total_bytes_; } | 62 int64 total_bytes() const { return total_bytes_; } |
| 64 int64 received_bytes() const { return received_bytes_; } | 63 int64 received_bytes() const { return received_bytes_; } |
| 65 int32 save_id() const { return save_id_; } | |
| 66 bool has_final_name() const { return has_final_name_; } | 64 bool has_final_name() const { return has_final_name_; } |
| 67 bool success() const { return is_success_; } | 65 bool success() const { return is_success_; } |
| 68 SaveFileCreateInfo::SaveFileSource save_source() const { | 66 SaveFileCreateInfo::SaveFileSource save_source() const { |
| 69 return save_source_; | 67 return save_source_; |
| 70 } | 68 } |
| 71 SavePackage* package() const { return package_; } | 69 SavePackage* package() const { return package_; } |
| 72 | 70 |
| 73 private: | 71 private: |
| 74 // Internal helper for maintaining consistent received and total sizes. | 72 // Internal helper for maintaining consistent received and total sizes. |
| 75 void UpdateSize(int64 size); | 73 void UpdateSize(int64 size); |
| 76 | 74 |
| 77 // Request ID assigned by the ResourceDispatcherHost. | 75 // Unique identifier for this SaveItem instance. |
| 78 int32 save_id_; | 76 const int save_item_id_; |
| 79 | 77 |
| 80 // Full path to the save item file. | 78 // Full path to the save item file. |
| 81 base::FilePath full_path_; | 79 base::FilePath full_path_; |
| 82 | 80 |
| 83 // Short display version of the file. | 81 // Short display version of the file. |
| 84 base::FilePath file_name_; | 82 base::FilePath file_name_; |
| 85 | 83 |
| 86 // The URL for this save item. | 84 // The URL for this save item. |
| 87 GURL url_; | 85 GURL url_; |
| 88 Referrer referrer_; | 86 Referrer referrer_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 106 | 104 |
| 107 // Our owning object. | 105 // Our owning object. |
| 108 SavePackage* package_; | 106 SavePackage* package_; |
| 109 | 107 |
| 110 DISALLOW_COPY_AND_ASSIGN(SaveItem); | 108 DISALLOW_COPY_AND_ASSIGN(SaveItem); |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 } // namespace content | 111 } // namespace content |
| 114 | 112 |
| 115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ | 113 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ |
| OLD | NEW |