| 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_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/download/base_file.h" | 11 #include "content/browser/download/base_file.h" |
| 12 #include "content/browser/download/save_types.h" | 12 #include "content/browser/download/save_types.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 // SaveFile ---------------------------------------------------------------- | 15 // SaveFile ---------------------------------------------------------------- |
| 16 | 16 |
| 17 // These objects live exclusively on the file thread and handle the writing | 17 // These objects live exclusively on the file thread and handle the writing |
| 18 // operations for one save item. These objects live only for the duration that | 18 // operations for one save item. These objects live only for the duration that |
| 19 // the saving job is 'in progress': once the saving job has been completed or | 19 // the saving job is 'in progress': once the saving job has been completed or |
| 20 // canceled, the SaveFile is destroyed. One SaveFile object represents one item | 20 // canceled, the SaveFile is destroyed. One SaveFile object represents one item |
| 21 // in a save session. | 21 // in a save session. |
| 22 class SaveFile { | 22 class SaveFile { |
| 23 public: | 23 public: |
| 24 explicit SaveFile(const SaveFileCreateInfo* info, bool calculate_hash); | 24 SaveFile(const SaveFileCreateInfo* info, bool calculate_hash); |
| 25 virtual ~SaveFile(); | 25 virtual ~SaveFile(); |
| 26 | 26 |
| 27 // BaseFile delegated functions. | 27 // BaseFile delegated functions. |
| 28 DownloadInterruptReason Initialize(); | 28 DownloadInterruptReason Initialize(); |
| 29 DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len); | 29 DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len); |
| 30 DownloadInterruptReason Rename(const FilePath& full_path); | 30 DownloadInterruptReason Rename(const FilePath& full_path); |
| 31 void Detach(); | 31 void Detach(); |
| 32 void Cancel(); | 32 void Cancel(); |
| 33 void Finish(); | 33 void Finish(); |
| 34 void AnnotateWithSourceInformation(); | 34 void AnnotateWithSourceInformation(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 private: | 50 private: |
| 51 BaseFile file_; | 51 BaseFile file_; |
| 52 scoped_ptr<const SaveFileCreateInfo> info_; | 52 scoped_ptr<const SaveFileCreateInfo> info_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(SaveFile); | 54 DISALLOW_COPY_AND_ASSIGN(SaveFile); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace content | 57 } // namespace content |
| 58 | 58 |
| 59 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ | 59 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ |
| OLD | NEW |