Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "content/public/browser/web_contents_observer.h" | |
| 11 #include "content/public/browser/web_contents_user_data.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class WebContents; | |
| 16 } | |
| 17 | |
| 18 namespace offline_pages { | |
| 19 | |
| 20 // Per-tab class to manage switch between online version and offline version. | |
| 21 class OfflinePageTabHelper : | |
| 22 public content::WebContentsObserver, | |
| 23 public content::WebContentsUserData<OfflinePageTabHelper> { | |
| 24 public: | |
| 25 ~OfflinePageTabHelper() override; | |
| 26 | |
| 27 private: | |
| 28 friend class content::WebContentsUserData<OfflinePageTabHelper>; | |
| 29 friend class OfflinePageTabHelperTest; | |
| 30 | |
| 31 explicit OfflinePageTabHelper(content::WebContents* web_contents); | |
| 32 | |
| 33 // Overridden from content::WebContentsObserver: | |
| 34 void DidStartProvisionalLoadForFrame( | |
| 35 content::RenderFrameHost* render_frame_host, | |
| 36 const GURL& validated_url, | |
| 37 bool is_error_page, | |
| 38 bool is_iframe_srcdoc) override; | |
| 39 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, | |
|
Pete Williamson
2016/02/25 18:05:31
nit: It might make the file easier to read if the
jianli
2016/02/25 21:34:52
Done.
| |
| 40 const GURL& validated_url, | |
| 41 int error_code, | |
| 42 const base::string16& error_description, | |
| 43 bool was_ignored_by_handler) override; | |
| 44 | |
| 45 void RedirectFromOfflineToOnline(const GURL& online_url); | |
| 46 void RedirectFromOnlineToOffline(const GURL& offline_url); | |
| 47 | |
| 48 GURL last_redirect_from_url_; | |
| 49 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); | |
| 52 }; | |
| 53 | |
| 54 } // namespace offline_pages | |
| 55 | |
| 56 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | |
| OLD | NEW |