summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/offline_pages/offline_page_utils.h
blob: 77d4d08e5603475c205d6831265b139f7a1bbe78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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 <stdint.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 exists.
  static GURL GetOfflineURLForOnlineURL(
      content::BrowserContext* browser_context,
      const GURL& online_url);

  // Gets an online URL of an offline page with |offline_url| if one exists.
  static GURL GetOnlineURLForOfflineURL(
      content::BrowserContext* browser_context,
      const GURL& offline_url);

  // Gets a bookmark ID related to the |offline_url|.
  static int64_t GetBookmarkIdForOfflineURL(
      content::BrowserContext* browser_context,
      const GURL& offline_url);

  // Checks whether |offline_url| points to an offline page.
  static bool IsOfflinePage(content::BrowserContext* browser_context,
                            const GURL& offline_url);

  // Checks whether offline page for |online_url| exists.
  static bool HasOfflinePageForOnlineURL(
      content::BrowserContext* browser_context,
      const GURL& online_url);

  // Checks whether any offline page is saved.
  static bool HasOfflinePages(content::BrowserContext* browser_context);
};

}  // namespace offline_pages

#endif  // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_