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

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

Issue 1721103002: Switch between online and offline version per network connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..23391974e910989f2a0f14fcde7d4a71eaa48df9
--- /dev/null
+++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.h
@@ -0,0 +1,54 @@
+// Copyright 2016 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_TAB_HELPER_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+#include "url/gurl.h"
+
+namespace content {
+class WebContents;
+}
+
+namespace offline_pages {
+
+// Per-tab class to manage switch between online version and offline version.
+class OfflinePageTabHelper :
+ public content::WebContentsObserver,
+ public content::WebContentsUserData<OfflinePageTabHelper> {
+ public:
+ ~OfflinePageTabHelper() override;
+
+ private:
+ friend class content::WebContentsUserData<OfflinePageTabHelper>;
+ friend class OfflinePageTabHelperTest;
+
+ explicit OfflinePageTabHelper(content::WebContents* web_contents);
+
+ // Overridden from content::WebContentsObserver:
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void DidFailProvisionalLoad(
+ content::RenderFrameHost* render_frame_host,
+ const GURL& validated_url,
+ int error_code,
+ const base::string16& error_description,
+ bool was_ignored_by_handler) override;
+
+ void RedirectFromOfflineToOnline(const GURL& online_url);
+ void RedirectFromOnlineToOffline(const GURL& offline_url);
+
+ GURL last_redirect_from_url_;
+ base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper);
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698