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 CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 6 #define CONTENT_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 "content/browser/power_save_blocker.h" | 14 #include "content/browser/power_save_blocker.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/file_stream.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 | 19 |
19 namespace crypto { | 20 namespace crypto { |
20 class SecureHash; | 21 class SecureHash; |
21 } | 22 } |
22 namespace net { | 23 namespace net { |
23 class FileStream; | 24 class FileStream; |
24 } | 25 } |
25 | 26 |
26 // File being downloaded and saved to disk. This is a base class | 27 // File being downloaded and saved to disk. This is a base class |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual void CreateFileStream(); // For testing. | 74 virtual void CreateFileStream(); // For testing. |
74 // Returns net::OK on success, or a network error code on failure. | 75 // Returns net::OK on success, or a network error code on failure. |
75 net::Error Open(); | 76 net::Error Open(); |
76 void Close(); | 77 void Close(); |
77 | 78 |
78 // Full path to the file including the file name. | 79 // Full path to the file including the file name. |
79 FilePath full_path_; | 80 FilePath full_path_; |
80 | 81 |
81 private: | 82 private: |
82 friend class BaseFileTest; | 83 friend class BaseFileTest; |
83 friend class DownloadFileWithMockStream; | |
84 | 84 |
85 static const size_t kSha256HashLen = 32; | 85 static const size_t kSha256HashLen = 32; |
86 | 86 |
87 // Source URL for the file being downloaded. | 87 // Source URL for the file being downloaded. |
88 GURL source_url_; | 88 GURL source_url_; |
89 | 89 |
90 // The URL where the download was initiated. | 90 // The URL where the download was initiated. |
91 GURL referrer_url_; | 91 GURL referrer_url_; |
92 | 92 |
93 // OS file stream for writing | 93 // OS file stream for writing |
(...skipping 15 matching lines...) Expand all Loading... |
109 unsigned char sha256_hash_[kSha256HashLen]; | 109 unsigned char sha256_hash_[kSha256HashLen]; |
110 | 110 |
111 // Indicates that this class no longer owns the associated file, and so | 111 // Indicates that this class no longer owns the associated file, and so |
112 // won't delete it on destruction. | 112 // won't delete it on destruction. |
113 bool detached_; | 113 bool detached_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 115 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
116 }; | 116 }; |
117 | 117 |
118 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 118 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
OLD | NEW |