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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_utils.h

Issue 2337363002: Load live version when reloading an offline page on connected network (Closed)
Patch Set: Update BUILD.gn Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 OfflinePageItem; 21 struct OfflinePageItem;
21 22
22 class OfflinePageUtils { 23 class OfflinePageUtils {
23 public: 24 public:
24 // Returns true if |url| might point to an offline page. 25 // Returns true if |url| might point to an offline page.
25 static bool MightBeOfflineURL(const GURL& url); 26 static bool MightBeOfflineURL(const GURL& url);
26 27
27 // Returns via callback an offline page saved for |online_url|, if any. The 28 // Returns via callback an offline page saved for |online_url|, if any. The
28 // page is chosen based on creation date; a more recently created offline 29 // page is chosen based on creation date; a more recently created offline
29 // page will be preferred over an older one. The offline page captured from 30 // page will be preferred over an older one. The offline page captured from
(...skipping 24 matching lines...) Expand all
54 // Marks that the offline page related to the |offline_url| has been accessed. 55 // Marks that the offline page related to the |offline_url| has been accessed.
55 static void MarkPageAccessed(content::BrowserContext* browser_context, 56 static void MarkPageAccessed(content::BrowserContext* browser_context,
56 const GURL& offline_url); 57 const GURL& offline_url);
57 58
58 // Gets the offline page corresponding to the given web contents. The 59 // Gets the offline page corresponding to the given web contents. The
59 // returned pointer is owned by the web_contents and may be deleted by user 60 // returned pointer is owned by the web_contents and may be deleted by user
60 // navigation, so it is unsafe to store a copy of the returned pointer. 61 // navigation, so it is unsafe to store a copy of the returned pointer.
61 static const OfflinePageItem* GetOfflinePageFromWebContents( 62 static const OfflinePageItem* GetOfflinePageFromWebContents(
62 content::WebContents* web_contents); 63 content::WebContents* web_contents);
63 64
65 // Gets the offline header provided when loading the offline page for the
66 // given web contents.
67 static const OfflinePageHeader* GetOfflineHeaderFromWebContents(
68 content::WebContents* web_contents);
69
64 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false, 70 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false,
65 // when tab is not available. Returns true otherwise and sets |tab_id| to the 71 // when tab is not available. Returns true otherwise and sets |tab_id| to the
66 // ID of the tab. 72 // ID of the tab.
67 static bool GetTabId(content::WebContents* web_contents, int* tab_id); 73 static bool GetTabId(content::WebContents* web_contents, int* tab_id);
68 }; 74 };
69 75
70 } // namespace offline_pages 76 } // namespace offline_pages
71 77
72 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ 78 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698