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_DOWNLOAD_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual std::string GetHashState() = 0; | 64 virtual std::string GetHashState() = 0; |
65 | 65 |
66 // Cancels the download request associated with this file. | 66 // Cancels the download request associated with this file. |
67 virtual void CancelDownloadRequest() = 0; | 67 virtual void CancelDownloadRequest() = 0; |
68 | 68 |
69 virtual int Id() const = 0; | 69 virtual int Id() const = 0; |
70 virtual DownloadManager* GetDownloadManager() = 0; | 70 virtual DownloadManager* GetDownloadManager() = 0; |
71 virtual const DownloadId& GlobalId() const = 0; | 71 virtual const DownloadId& GlobalId() const = 0; |
72 | 72 |
73 virtual std::string DebugString() const = 0; | 73 virtual std::string DebugString() const = 0; |
74 | |
75 // Appends the passed-in |number| between parenthesis to the |path| before | |
76 // the file extension. | |
77 static void AppendNumberToPath(FilePath* path, int number); | |
78 | |
79 // Appends the passed-in |suffix| to the |path|. | |
80 static FilePath AppendSuffixToPath(const FilePath& path, | |
81 const FilePath::StringType& suffix); | |
82 | |
83 // Attempts to find a number that can be appended to the |path| to make it | |
84 // unique. If |path| does not exist, 0 is returned. If it fails to find such | |
85 // a number, -1 is returned. | |
86 static int GetUniquePathNumber(const FilePath& path); | |
87 | |
88 // Same as GetUniquePathNumber, except that it also checks the existence | |
89 // of it with the given suffix. | |
90 // If |path| does not exist, 0 is returned. If it fails to find such | |
91 // a number, -1 is returned. | |
92 static int GetUniquePathNumberWithSuffix( | |
93 const FilePath& path, | |
94 const FilePath::StringType& suffix); | |
95 }; | 74 }; |
96 | 75 |
97 } // namespace content | 76 } // namespace content |
98 | 77 |
99 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 78 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
OLD | NEW |