Chromium Code Reviews| Index: chrome/browser/android/offline_pages/offline_page_tab_helper.h |
| diff --git a/chrome/browser/android/offline_pages/offline_page_tab_helper.h b/chrome/browser/android/offline_pages/offline_page_tab_helper.h |
| index b63505107fe6f63bfd09cec8fcb4f18ddc09fc8c..986b330e4769f188c35855da38a6dc7276792808 100644 |
| --- a/chrome/browser/android/offline_pages/offline_page_tab_helper.h |
| +++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.h |
| @@ -7,6 +7,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "components/offline_pages/offline_page_types.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| #include "url/gurl.h" |
| @@ -16,6 +17,7 @@ class WebContents; |
| } |
| namespace offline_pages { |
| +struct OfflinePageItem; |
|
jianli
2016/06/15 00:44:00
nit: add an empty line
dewittj
2016/06/15 17:21:05
Done.
|
| // Per-tab class to manage switch between online version and offline version. |
| class OfflinePageTabHelper : |
| @@ -24,7 +26,15 @@ class OfflinePageTabHelper : |
| public: |
| ~OfflinePageTabHelper() override; |
| + const OfflinePageItem* offline_page() { return offline_page_.get(); } |
| + |
| private: |
| + enum class RedirectReason { |
| + DISCONNECTED_NETWORK, |
| + FLAKY_NETWORK, |
| + FLAKY_NETWORK_FORWARD_BACK |
| + }; |
| + |
| friend class content::WebContentsUserData<OfflinePageTabHelper>; |
| friend class OfflinePageTabHelperTest; |
| FRIEND_TEST_ALL_PREFIXES(OfflinePageTabHelperTest, |
| @@ -38,14 +48,17 @@ class OfflinePageTabHelper : |
| void DidFinishNavigation( |
| content::NavigationHandle* navigation_handle) override; |
| - void GotRedirectURLForSupportedErrorCode(ui::PageTransition transition, |
| - const GURL& from_url, |
| - const GURL& redirect_url); |
| - void GotRedirectURLForStartedNavigation(const GURL& from_url, |
| - const GURL& redirect_url); |
| + void RedirectToOnline(const GURL& from_url, |
| + const OfflinePageItem* offline_page); |
| + void TryRedirectToOffline(RedirectReason redirect_reason, |
| + const GURL& from_url, |
| + const OfflinePageItem* offline_page); |
| - void Redirect(const GURL& from_url, const GURL& to_url); |
| + void Redirect(const GURL& from_url, |
| + const GURL& to_url, |
| + const OfflinePageItem* offline_page); |
| + std::unique_ptr<OfflinePageItem> offline_page_; |
|
jianli
2016/06/15 00:44:00
Please comment this.
dewittj
2016/06/15 17:21:05
Done.
|
| base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); |