Chromium Code Reviews| 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" | 10 #include "base/callback.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class BrowserContext; | 15 class BrowserContext; |
| 16 class WebContents; | 16 class WebContents; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace offline_pages { | 19 namespace offline_pages { |
| 20 struct OfflinePageHeader; | 20 struct OfflinePageHeader; |
| 21 struct OfflinePageItem; | 21 struct OfflinePageItem; |
| 22 | 22 |
| 23 class OfflinePageUtils { | 23 class OfflinePageUtils { |
| 24 public: | 24 public: |
| 25 // Returns via callback an offline page saved for |online_url|, if any. The | 25 // Returns via callback an offline page saved for |online_url|, if any. The |
| 26 // page is chosen based on creation date; a more recently created offline | 26 // page is chosen based on creation date; a more recently created offline |
| 27 // page will be preferred over an older one. The offline page captured from | 27 // page will be preferred over an older one. The offline page captured from |
| 28 // last visit in the tab will not be considered if its tab id does not match | 28 // last visit in the tab will not be considered if its tab id does not match |
| 29 // the provided |tab_id|. | 29 // the provided |tab_id|. |
| 30 static void SelectPageForOnlineURL( | 30 static void SelectPageForURL( |
| 31 content::BrowserContext* browser_context, | 31 content::BrowserContext* browser_context, |
| 32 const GURL& online_url, | 32 const GURL& url, |
| 33 bool search_by_final_url_only, | |
|
fgorski
2016/11/16 23:43:46
Can we have an enum for this, as opposed to a bool
jianli
2016/11/17 01:12:14
Done.
| |
| 33 int tab_id, | 34 int tab_id, |
| 34 const base::Callback<void(const OfflinePageItem*)>& callback); | 35 const base::Callback<void(const OfflinePageItem*)>& callback); |
| 35 | 36 |
| 36 // Gets the offline page corresponding to the given web contents. The | 37 // Gets the offline page corresponding to the given web contents. The |
| 37 // returned pointer is owned by the web_contents and may be deleted by user | 38 // returned pointer is owned by the web_contents and may be deleted by user |
| 38 // navigation, so it is unsafe to store a copy of the returned pointer. | 39 // navigation, so it is unsafe to store a copy of the returned pointer. |
| 39 static const OfflinePageItem* GetOfflinePageFromWebContents( | 40 static const OfflinePageItem* GetOfflinePageFromWebContents( |
| 40 content::WebContents* web_contents); | 41 content::WebContents* web_contents); |
| 41 | 42 |
| 42 // Gets the offline header provided when loading the offline page for the | 43 // Gets the offline header provided when loading the offline page for the |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 63 const std::string name_space, | 64 const std::string name_space, |
| 64 const GURL& offline_page_url, | 65 const GURL& offline_page_url, |
| 65 const base::Callback<void(bool)>& callback); | 66 const base::Callback<void(bool)>& callback); |
| 66 | 67 |
| 67 static bool EqualsIgnoringFragment(const GURL& lhs, const GURL& rhs); | 68 static bool EqualsIgnoringFragment(const GURL& lhs, const GURL& rhs); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace offline_pages | 71 } // namespace offline_pages |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 73 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
| OLD | NEW |