| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 11 |
| 10 class GURL; | 12 class GURL; |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 class BrowserContext; | 15 class BrowserContext; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace offline_pages { | 18 namespace offline_pages { |
| 17 struct OfflinePageItem; | 19 struct OfflinePageItem; |
| 18 | 20 |
| 19 class OfflinePageUtils { | 21 class OfflinePageUtils { |
| 20 public: | 22 public: |
| 21 // Returns true if |url| might point to an offline page. | 23 // Returns true if |url| might point to an offline page. |
| 22 static bool MightBeOfflineURL(const GURL& url); | 24 static bool MightBeOfflineURL(const GURL& url); |
| 23 | 25 |
| 24 // Gets an offline URL of an offline page with |online_url| if one exists. | 26 // Gets an offline URL of an offline page with |online_url| if one exists. |
| 25 static GURL GetOfflineURLForOnlineURL( | 27 // Deprecated. Use |GetOfflineURLForOnlineURL|. |
| 28 static GURL MaybeGetOfflineURLForOnlineURL( |
| 26 content::BrowserContext* browser_context, | 29 content::BrowserContext* browser_context, |
| 27 const GURL& online_url); | 30 const GURL& online_url); |
| 28 | 31 |
| 32 static void GetOfflineURLForOnlineURL( |
| 33 content::BrowserContext* browser_context, |
| 34 const GURL& online_url, |
| 35 const base::Callback<void(const GURL&)>& callback); |
| 36 |
| 29 // Gets an online URL of an offline page with |offline_url| if one exists. | 37 // Gets an online URL of an offline page with |offline_url| if one exists. |
| 30 static GURL GetOnlineURLForOfflineURL( | 38 // Deprecated. Use |GetOnlineURLForOfflineURL|. |
| 39 static GURL MaybeGetOnlineURLForOfflineURL( |
| 31 content::BrowserContext* browser_context, | 40 content::BrowserContext* browser_context, |
| 32 const GURL& offline_url); | 41 const GURL& offline_url); |
| 33 | 42 |
| 43 static void GetOnlineURLForOfflineURL( |
| 44 content::BrowserContext* browser_context, |
| 45 const GURL& offline_url, |
| 46 const base::Callback<void(const GURL&)>& callback); |
| 47 |
| 34 // Checks whether |offline_url| points to an offline page. | 48 // Checks whether |offline_url| points to an offline page. |
| 49 // Deprecated. Use something else. |
| 35 static bool IsOfflinePage(content::BrowserContext* browser_context, | 50 static bool IsOfflinePage(content::BrowserContext* browser_context, |
| 36 const GURL& offline_url); | 51 const GURL& offline_url); |
| 37 | 52 |
| 38 // Checks whether offline page for |online_url| exists. | 53 // Checks whether offline page for |online_url| exists. |
| 39 static bool HasOfflinePageForOnlineURL( | 54 static bool HasOfflinePageForOnlineURL( |
| 40 content::BrowserContext* browser_context, | 55 content::BrowserContext* browser_context, |
| 41 const GURL& online_url); | 56 const GURL& online_url); |
| 42 | 57 |
| 43 // Marks that the offline page related to the |offline_url| has been accessed. | 58 // Marks that the offline page related to the |offline_url| has been accessed. |
| 44 static void MarkPageAccessed(content::BrowserContext* browser_context, | 59 static void MarkPageAccessed(content::BrowserContext* browser_context, |
| 45 const GURL& offline_url); | 60 const GURL& offline_url); |
| 46 }; | 61 }; |
| 47 | 62 |
| 48 } // namespace offline_pages | 63 } // namespace offline_pages |
| 49 | 64 |
| 50 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 65 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
| OLD | NEW |