| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DOWNLOAD_BASE_FILE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/power_save_blocker.h" | 14 #include "chrome/browser/power_save_blocker.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace crypto { |
| 18 class SecureHash; | 18 class SecureHash; |
| 19 } | 19 } |
| 20 namespace net { | 20 namespace net { |
| 21 class FileStream; | 21 class FileStream; |
| 22 } | 22 } |
| 23 | 23 |
| 24 // File being downloaded and saved to disk. This is a base class | 24 // File being downloaded and saved to disk. This is a base class |
| 25 // for DownloadFile and SaveFile, which keep more state information. | 25 // for DownloadFile and SaveFile, which keep more state information. |
| 26 class BaseFile { | 26 class BaseFile { |
| 27 public: | 27 public: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 int64 bytes_so_far_; | 87 int64 bytes_so_far_; |
| 88 | 88 |
| 89 // RAII handle to keep the system from sleeping while we're downloading. | 89 // RAII handle to keep the system from sleeping while we're downloading. |
| 90 PowerSaveBlocker power_save_blocker_; | 90 PowerSaveBlocker power_save_blocker_; |
| 91 | 91 |
| 92 // Indicates if sha256 hash should be calculated for the file. | 92 // Indicates if sha256 hash should be calculated for the file. |
| 93 bool calculate_hash_; | 93 bool calculate_hash_; |
| 94 | 94 |
| 95 // Used to calculate sha256 hash for the file when calculate_hash_ | 95 // Used to calculate sha256 hash for the file when calculate_hash_ |
| 96 // is set. | 96 // is set. |
| 97 scoped_ptr<base::SecureHash> secure_hash_; | 97 scoped_ptr<crypto::SecureHash> secure_hash_; |
| 98 | 98 |
| 99 unsigned char sha256_hash_[kSha256HashLen]; | 99 unsigned char sha256_hash_[kSha256HashLen]; |
| 100 | 100 |
| 101 // Indicates that this class no longer owns the associated file, and so | 101 // Indicates that this class no longer owns the associated file, and so |
| 102 // won't delete it on destruction. | 102 // won't delete it on destruction. |
| 103 bool detached_; | 103 bool detached_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 105 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 #endif // CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ | 108 #endif // CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |