Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: chrome/browser/android/offline_pages/offline_page_utils.h

Issue 2040163003: Refactors offline page tab helper to stash the offline page item on redirect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@single-result
Patch Set: Add a dedicated test. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/offline_page_utils.h
diff --git a/chrome/browser/android/offline_pages/offline_page_utils.h b/chrome/browser/android/offline_pages/offline_page_utils.h
index 6bccdc3d44497184a91878e4dda242b3f71029bd..ce694542497552ec8bce10f67db95c9308a1db5d 100644
--- a/chrome/browser/android/offline_pages/offline_page_utils.h
+++ b/chrome/browser/android/offline_pages/offline_page_utils.h
@@ -13,6 +13,7 @@ class GURL;
namespace content {
class BrowserContext;
+class WebContents;
}
namespace offline_pages {
@@ -58,6 +59,17 @@ class OfflinePageUtils {
// Marks that the offline page related to the |offline_url| has been accessed.
static void MarkPageAccessed(content::BrowserContext* browser_context,
const GURL& offline_url);
+
+ // Gets the offline page corresponding to the given web contents. The
+ // returned pointer is owned by the web_contents and may be deleted by user
+ // navigation, so it is unsafe to store a copy of the returned pointer.
+ static const OfflinePageItem* GetCurrentOfflinePage(
+ content::WebContents* web_contents);
+
+ // Sets the offline page corresponding to the given web contents. If
+ // |offline_page| contains |nullptr|, removes the page from the web contents.
+ static void SetCurrentOfflinePage(content::WebContents* web_contents,
+ const OfflinePageItem* offline_page);
};
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698