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

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

Issue 1521193002: [Offline pages] Refactor URL conversions from TabAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback, updating tests, moving functions to a static class Created 5 years 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
new file mode 100644
index 0000000000000000000000000000000000000000..50858997331cd39e564885b8d8d54a865eb02bcb
--- /dev/null
+++ b/chrome/browser/android/offline_pages/offline_page_utils.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_
+
+#include "base/basictypes.h"
+
+class GURL;
+
+namespace content {
+class BrowserContext;
+}
+
+namespace offline_pages {
+struct OfflinePageItem;
+
+class OfflinePageUtils {
+ public:
+ // Returns true if |url| might point to an offline page.
+ static bool MightBeOfflineURL(const GURL& url);
+
+ // Gets an offline URL of an offline page with |online_url| if one is present
+ // in the |browser_context|.
+ static GURL GetOfflineURLByOnlineURL(content::BrowserContext* browser_context,
newt (away) 2015/12/17 03:08:45 "By" doesn't seem like the right preposition. Mayb
fgorski 2015/12/17 19:00:14 Done.
+ const GURL& online_url);
+
+ // Gets an online URL of an offline page with |offline_url| if one is present
+ // in
newt (away) 2015/12/17 03:08:45 nit: wrapping
fgorski 2015/12/17 19:00:14 Done.
+ // the |browser_context|.
+ static GURL GetOnlineURLByOfflineURL(content::BrowserContext* browser_context,
+ const GURL& offline_url);
+
+ // Gets a bookmark ID related to the |offline_url|.
+ static int64 GetBookmarkIdByOfflineURL(
+ content::BrowserContext* browser_context,
+ const GURL& offline_url);
+
+ // Checks whether a given |offline_url| points to an offline page.
jianli 2015/12/16 23:08:07 nit: drop "given"
fgorski 2015/12/17 19:00:14 Done.
+ static bool IsOfflinePage(content::BrowserContext* browser_context,
+ const GURL& offline_url);
+
+ // Checks whether a given |online_url| has a related offline page.
jianli 2015/12/16 23:08:07 nit: "related to" sounds a bit not intuitive. Also
fgorski 2015/12/17 19:00:14 Done.
+ static bool HasOfflinePageForOnlineURL(
+ content::BrowserContext* browser_context,
+ const GURL& online_url);
+
+ // Checks if there are any offline pages saved in the |browser_context|
jianli 2015/12/16 23:08:07 nit: suggest dropping the comment for browser_cont
fgorski 2015/12/17 19:00:14 Done.
+ static const bool HasOfflinePages(content::BrowserContext* browser_context);
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698