| 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 "base/strings/string16.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace reading_list { | 14 namespace reading_list { |
| 15 | 15 |
| 16 // 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|. |
| 17 GURL DistilledURLForPath(const base::FilePath& path, const GURL& virtual_url); | 17 // |entry_url| is the URL of the ReadingListEntry. |
| 18 // |virtual_url| is the URL to display in the omnibox. This can be different |
| 19 // from |entry_url| is the distillation was done after a redirection. |
| 20 // |entry_url| and |virtual_url| are optionnal. |
| 21 GURL OfflineURLForPath(const base::FilePath& distilled_path, |
| 22 const GURL& entry_url, |
| 23 const GURL& virtual_url); |
| 18 | 24 |
| 19 // If |distilled_url| has a query "virtualURL" query params that is a URL, | 25 // If |offline_url| has a "entryURL" query params that is a URL, returns it. |
| 20 // returns it. If not, return |distilled_url| | 26 // If not, return |offline_url| |
| 21 GURL VirtualURLForDistilledURL(const GURL& distilled_url); | 27 GURL EntryURLForOfflineURL(const GURL& offline_url); |
| 28 |
| 29 // If |offline_url| has a "virtualURL" query params that is a URL, returns it. |
| 30 // If not, return |EntryURLForOfflineURL(|offline_url|)| |
| 31 GURL VirtualURLForOfflineURL(const GURL& offline_url); |
| 22 | 32 |
| 23 // The file URL pointing to the local file to load to display |distilled_url|. | 33 // The file URL pointing to the local file to load to display |distilled_url|. |
| 24 // If |resources_root_url| is not nullptr, it is set to a file URL to the | 34 // If |resources_root_url| is not nullptr, it is set to a file URL to the |
| 25 // directory conatining all the resources needed by |distilled_url|. | 35 // directory conatining all the resources needed by |distilled_url|. |
| 26 // |offline_path| is the root path to the directory containing offline files. | 36 // |offline_path| is the root path to the directory containing offline files. |
| 27 GURL FileURLForDistilledURL(const GURL& distilled_url, | 37 GURL FileURLForDistilledURL(const GURL& distilled_url, |
| 28 const base::FilePath& offline_path, | 38 const base::FilePath& offline_path, |
| 29 GURL* resources_root_url); | 39 GURL* resources_root_url); |
| 30 | 40 |
| 31 // Returns whether the URL points to a chrome offline URL. | 41 // Returns whether the URL points to a chrome offline URL. |
| 32 bool IsOfflineURL(const GURL& url); | 42 bool IsOfflineURL(const GURL& url); |
| 33 | 43 |
| 34 } // namespace reading_list | 44 } // namespace reading_list |
| 35 | 45 |
| 36 #endif // IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ | 46 #endif // IOS_CHROME_BROWSER_READING_LIST_OFFLINE_URL_UTILS_H_ |
| OLD | NEW |