OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_READING_LIST_IOS_OFFLINE_URL_UTILS_H_ | |
6 #define COMPONENTS_READING_LIST_IOS_OFFLINE_URL_UTILS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "url/gurl.h" | |
12 | |
13 namespace reading_list { | |
14 | |
15 // The different types of file that can be stored for offline usage. | |
16 enum OfflineFileType { OFFLINE_TYPE_HTML = 0, OFFLINE_TYPE_PDF = 1 }; | |
17 | |
18 // The absolute path of the directory where offline URLs are saved. | |
19 // |profile_path| is the path to the profile directory that contain the offline | |
20 // directory. | |
21 base::FilePath OfflineRootDirectoryPath(const base::FilePath& profile_path); | |
22 | |
23 // The absolute path of |relative_path| where |relative_path| is relative to the | |
24 // offline root folder (OfflineRootDirectoryPath). | |
25 // |profile_path| is the path to the profile directory that contain the offline | |
26 // directory. | |
27 // The file/directory may not exist. | |
28 base::FilePath OfflineURLAbsolutePathFromRelativePath( | |
29 const base::FilePath& profile_path, | |
30 const base::FilePath& relative_path); | |
31 | |
32 // The absolute path of the directory where a |url| is saved offline. | |
33 // Contains the page and supporting files (images). | |
34 // |profile_path| is the path to the profile directory that contain the offline | |
35 // directory. | |
36 // The directory may not exist. | |
37 base::FilePath OfflineURLDirectoryAbsolutePath( | |
38 const base::FilePath& profile_path, | |
39 const GURL& url); | |
40 | |
41 // The relative path to the offline webpage for the |url|. The result is | |
42 // relative to |OfflineRootDirectoryPath()|. |type| is the type of the file and | |
43 // will determine the extension of the returned value. | |
44 // The file may not exist. | |
45 base::FilePath OfflinePagePath(const GURL& url, OfflineFileType type); | |
46 | |
47 // The name of the directory containing offline data for |url|. | |
48 std::string OfflineURLDirectoryID(const GURL& url); | |
49 | |
50 } // namespace reading_list | |
51 | |
52 #endif // COMPONENTS_READING_LIST_IOS_OFFLINE_URL_UTILS_H_ | |
OLD | NEW |