OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 content::NavigationHandle* navigation_handle) override; | 45 content::NavigationHandle* navigation_handle) override; |
46 void DidFinishNavigation( | 46 void DidFinishNavigation( |
47 content::NavigationHandle* navigation_handle) override; | 47 content::NavigationHandle* navigation_handle) override; |
48 | 48 |
49 void SelectPageForOnlineURLDone(const OfflinePageItem* offline_page); | 49 void SelectPageForOnlineURLDone(const OfflinePageItem* offline_page); |
50 | 50 |
51 // The cached copy of OfflinePageItem if offline page is loaded for current | 51 // The cached copy of OfflinePageItem if offline page is loaded for current |
52 // tab. This can be used to by the Tab to synchronously ask about the offline | 52 // tab. This can be used to by the Tab to synchronously ask about the offline |
53 // info. | 53 // info. |
54 std::unique_ptr<OfflinePageItem> offline_page_; | 54 std::unique_ptr<OfflinePageItem> offline_page_; |
| 55 // Potential new offline page copy. This is reset to nullptr at the start |
| 56 // of every navigation and set by network request interceptor. If the |
| 57 // interceptor decided to not use offline page for the navigation or was not |
| 58 // even invoked (as in case with fragment navigation), this stays nullptr. |
| 59 std::unique_ptr<OfflinePageItem> new_offline_page_; |
55 | 60 |
56 bool reloading_url_on_net_error_ = false; | 61 bool reloading_url_on_net_error_ = false; |
57 | 62 |
58 // Whether the page is an offline preview. Offline page previews are shown | 63 // Whether the page is an offline preview. Offline page previews are shown |
59 // when a user's effective connection type is prohibitively slow. | 64 // when a user's effective connection type is prohibitively slow. |
60 bool is_offline_preview_; | 65 bool is_offline_preview_; |
61 | 66 |
62 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; | 67 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; |
63 | 68 |
64 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); | 69 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); |
65 }; | 70 }; |
66 | 71 |
67 } // namespace offline_pages | 72 } // namespace offline_pages |
68 | 73 |
69 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ | 74 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ |
OLD | NEW |