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

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

Issue 2225213002: Make GetBestPageForOnlineURL async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make GetBestPageForOnlineURL async Created 4 years, 4 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 OfflinePageItem; 20 struct OfflinePageItem;
21 21
22 class OfflinePageUtils { 22 class OfflinePageUtils {
23 public: 23 public:
24 // Returns true if |url| might point to an offline page. 24 // Returns true if |url| might point to an offline page.
25 static bool MightBeOfflineURL(const GURL& url); 25 static bool MightBeOfflineURL(const GURL& url);
26 26
27 // Returns via callback an offline page saved for |online_url|, if any. The
28 // best page is chosen based on creation date; a more recently created offline
29 // page will be preferred over an older one.
Dmitry Titov 2016/08/10 02:56:37 please add info to the comment on why tab_id is pa
jianli 2016/08/11 00:33:27 Per discussion, renamed to SelectPageForOnlineURL.
30 static void GetBestPageForOnlineURL(
31 content::BrowserContext* browser_context,
32 const GURL& online_url,
33 int tab_id,
34 const base::Callback<void(const OfflinePageItem*)>& callback);
35
27 // Gets an online URL of an offline page with |offline_url| if one exists. 36 // Gets an online URL of an offline page with |offline_url| if one exists.
28 // Deprecated. Use |GetOnlineURLForOfflineURL|. 37 // Deprecated. Use |GetOnlineURLForOfflineURL|.
29 static GURL MaybeGetOnlineURLForOfflineURL( 38 static GURL MaybeGetOnlineURLForOfflineURL(
30 content::BrowserContext* browser_context, 39 content::BrowserContext* browser_context,
31 const GURL& offline_url); 40 const GURL& offline_url);
32 41
33 static void GetOnlineURLForOfflineURL( 42 static void GetOnlineURLForOfflineURL(
34 content::BrowserContext* browser_context, 43 content::BrowserContext* browser_context,
35 const GURL& offline_url, 44 const GURL& offline_url,
36 const base::Callback<void(const GURL&)>& callback); 45 const base::Callback<void(const GURL&)>& callback);
(...skipping 20 matching lines...) Expand all
57 66
58 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false, 67 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false,
59 // when tab is not available. Returns true otherwise and sets |tab_id| to the 68 // when tab is not available. Returns true otherwise and sets |tab_id| to the
60 // ID of the tab. 69 // ID of the tab.
61 static bool GetTabId(content::WebContents* web_contents, int* tab_id); 70 static bool GetTabId(content::WebContents* web_contents, int* tab_id);
62 }; 71 };
63 72
64 } // namespace offline_pages 73 } // namespace offline_pages
65 74
66 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ 75 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698