OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ |
6 #define IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/strings/string16.h" |
11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
12 | 13 |
13 namespace reading_list { | 14 namespace reading_list { |
14 | 15 |
15 // The distilled URL chrome://offline/... that will load the file at |path|. | 16 // The distilled URL chrome://offline/... that will load the file at |path|. |
16 GURL DistilledURLForPath(const base::FilePath& path, const GURL& virtual_url); | 17 GURL DistilledURLForPath(const base::FilePath& path, const GURL& virtual_url); |
17 | 18 |
18 // If |distilled_url| has a query "virtualURL" query params that is a URL, | 19 // If |distilled_url| has a query "virtualURL" query params that is a URL, |
19 // returns it. If not, return |distilled_url| | 20 // returns it. If not, return |distilled_url| |
20 GURL VirtualURLForDistilledURL(const GURL& distilled_url); | 21 GURL VirtualURLForDistilledURL(const GURL& distilled_url); |
21 | 22 |
22 // The file URL pointing to the local file to load to display |distilled_url|. | 23 // The file URL pointing to the local file to load to display |distilled_url|. |
23 // If |resources_root_url| is not nullptr, it is set to a file URL to the | 24 // If |resources_root_url| is not nullptr, it is set to a file URL to the |
24 // directory conatining all the resources needed by |distilled_url|. | 25 // directory conatining all the resources needed by |distilled_url|. |
25 // |offline_path| is the root path to the directory containing offline files. | 26 // |offline_path| is the root path to the directory containing offline files. |
26 GURL FileURLForDistilledURL(const GURL& distilled_url, | 27 GURL FileURLForDistilledURL(const GURL& distilled_url, |
27 const base::FilePath& offline_path, | 28 const base::FilePath& offline_path, |
28 GURL* resources_root_url); | 29 GURL* resources_root_url); |
29 | 30 |
30 // Returns whether the URL points to a chrome offline URL. | 31 // Returns whether the URL points to a chrome offline URL. |
31 bool IsOfflineURL(const GURL& url); | 32 bool IsOfflineURL(const GURL& url); |
32 | 33 |
| 34 // Strips scheme from the original URL of the offline page. This is meant to be |
| 35 // used by UI. |
| 36 // If |removed_chars| is non-NULL, it is set to the number of chars that have |
| 37 // been removed at the begining of |online_url|. |
| 38 base::string16 StripSchemeFromOnlineURL(const base::string16& online_url, |
| 39 size_t* removed_chars); |
| 40 |
33 } // namespace reading_list | 41 } // namespace reading_list |
34 | 42 |
35 #endif // IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ | 43 #endif // IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ |
OLD | NEW |