| OLD | NEW |
| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // returned pointer is owned by the web_contents and may be deleted by user | 37 // returned pointer is owned by the web_contents and may be deleted by user |
| 38 // navigation, so it is unsafe to store a copy of the returned pointer. | 38 // navigation, so it is unsafe to store a copy of the returned pointer. |
| 39 static const OfflinePageItem* GetOfflinePageFromWebContents( | 39 static const OfflinePageItem* GetOfflinePageFromWebContents( |
| 40 content::WebContents* web_contents); | 40 content::WebContents* web_contents); |
| 41 | 41 |
| 42 // Gets the offline header provided when loading the offline page for the | 42 // Gets the offline header provided when loading the offline page for the |
| 43 // given web contents. | 43 // given web contents. |
| 44 static const OfflinePageHeader* GetOfflineHeaderFromWebContents( | 44 static const OfflinePageHeader* GetOfflineHeaderFromWebContents( |
| 45 content::WebContents* web_contents); | 45 content::WebContents* web_contents); |
| 46 | 46 |
| 47 // Returns true if the offline page is shown for previewing purpose. |
| 48 static bool IsShowingOfflinePreview(content::WebContents* web_contents); |
| 49 |
| 47 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false, | 50 // Gets an Android Tab ID from a tab containing |web_contents|. Returns false, |
| 48 // when tab is not available. Returns true otherwise and sets |tab_id| to the | 51 // when tab is not available. Returns true otherwise and sets |tab_id| to the |
| 49 // ID of the tab. | 52 // ID of the tab. |
| 50 static bool GetTabId(content::WebContents* web_contents, int* tab_id); | 53 static bool GetTabId(content::WebContents* web_contents, int* tab_id); |
| 51 | 54 |
| 52 static void CheckExistenceOfPagesWithURL( | 55 static void CheckExistenceOfPagesWithURL( |
| 53 content::BrowserContext* browser_context, | 56 content::BrowserContext* browser_context, |
| 54 const std::string name_space, | 57 const std::string name_space, |
| 55 const GURL& offline_url, | 58 const GURL& offline_url, |
| 56 const base::Callback<void(bool)>& callback); | 59 const base::Callback<void(bool)>& callback); |
| 57 | 60 |
| 58 static void CheckExistenceOfRequestsWithURL( | 61 static void CheckExistenceOfRequestsWithURL( |
| 59 content::BrowserContext* browser_context, | 62 content::BrowserContext* browser_context, |
| 60 const std::string name_space, | 63 const std::string name_space, |
| 61 const GURL& offline_page_url, | 64 const GURL& offline_page_url, |
| 62 const base::Callback<void(bool)>& callback); | 65 const base::Callback<void(bool)>& callback); |
| 63 | 66 |
| 64 static bool EqualsIgnoringFragment(const GURL& lhs, const GURL& rhs); | 67 static bool EqualsIgnoringFragment(const GURL& lhs, const GURL& rhs); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace offline_pages | 70 } // namespace offline_pages |
| 68 | 71 |
| 69 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 72 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
| OLD | NEW |