| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 53 void SetSaveId(int32 save_id); |
| 54 | 54 |
| 55 void SetTotalBytes(int64 total_bytes); | 55 void SetTotalBytes(int64 total_bytes); |
| 56 | 56 |
| 57 // Set last data received. |
| 58 // This is in fact a "substate" of IN_PROGRESS, should be set only after |
| 59 // after receiving the last portion of data from the renderer. |
| 60 // This is only used as a workaround for the flawed architecture of save |
| 61 // page functionality, which doesn't allow to save more than one serializable |
| 62 // resource per url. |
| 63 void SetLastDataReceived(); |
| 64 |
| 57 // Accessors. | 65 // Accessors. |
| 58 SaveState state() const { return state_; } | 66 SaveState state() const { return state_; } |
| 67 bool last_data_received() const { return last_data_received_; } |
| 59 const base::FilePath& full_path() const { return full_path_; } | 68 const base::FilePath& full_path() const { return full_path_; } |
| 60 const base::FilePath& file_name() const { return file_name_; } | 69 const base::FilePath& file_name() const { return file_name_; } |
| 61 const GURL& url() const { return url_; } | 70 const GURL& url() const { return url_; } |
| 62 const Referrer& referrer() const { return referrer_; } | 71 const Referrer& referrer() const { return referrer_; } |
| 63 int64 total_bytes() const { return total_bytes_; } | 72 int64 total_bytes() const { return total_bytes_; } |
| 64 int64 received_bytes() const { return received_bytes_; } | 73 int64 received_bytes() const { return received_bytes_; } |
| 65 int32 save_id() const { return save_id_; } | 74 int32 save_id() const { return save_id_; } |
| 66 bool has_final_name() const { return has_final_name_; } | 75 bool has_final_name() const { return has_final_name_; } |
| 67 bool success() const { return is_success_; } | 76 bool success() const { return is_success_; } |
| 68 SaveFileCreateInfo::SaveFileSource save_source() const { | 77 SaveFileCreateInfo::SaveFileSource save_source() const { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 95 | 104 |
| 96 // The current state of this save item. | 105 // The current state of this save item. |
| 97 SaveState state_; | 106 SaveState state_; |
| 98 | 107 |
| 99 // Specifies if this name is a final or not. | 108 // Specifies if this name is a final or not. |
| 100 bool has_final_name_; | 109 bool has_final_name_; |
| 101 | 110 |
| 102 // Flag indicates whether SaveItem has error while in saving process. | 111 // Flag indicates whether SaveItem has error while in saving process. |
| 103 bool is_success_; | 112 bool is_success_; |
| 104 | 113 |
| 114 // Becomes true after receiving the last portion of data from the renderer. |
| 115 bool last_data_received_; |
| 116 |
| 105 SaveFileCreateInfo::SaveFileSource save_source_; | 117 SaveFileCreateInfo::SaveFileSource save_source_; |
| 106 | 118 |
| 107 // Our owning object. | 119 // Our owning object. |
| 108 SavePackage* package_; | 120 SavePackage* package_; |
| 109 | 121 |
| 110 DISALLOW_COPY_AND_ASSIGN(SaveItem); | 122 DISALLOW_COPY_AND_ASSIGN(SaveItem); |
| 111 }; | 123 }; |
| 112 | 124 |
| 113 } // namespace content | 125 } // namespace content |
| 114 | 126 |
| 115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ | 127 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ |
| OLD | NEW |