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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_tab_helper.h

Issue 2462653002: Showing previews UI for Offline Previews (Closed)
Patch Set: fgorski comment Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 24 matching lines...) Expand all
35 35
36 const OfflinePageItem* offline_page() { 36 const OfflinePageItem* offline_page() {
37 return offline_info_.offline_page.get(); 37 return offline_info_.offline_page.get();
38 } 38 }
39 39
40 const OfflinePageHeader& offline_header() const { 40 const OfflinePageHeader& offline_header() const {
41 return offline_info_.offline_header; 41 return offline_info_.offline_header;
42 } 42 }
43 43
44 // Whether the page is an offline preview. 44 // Whether the page is an offline preview.
45 bool is_offline_preview() const { return offline_info_.is_offline_preview; } 45 bool IsShowingOfflinePreview() const;
46 46
47 // Returns provisional offline page since actual navigation does not happen 47 // Returns provisional offline page since actual navigation does not happen
48 // during unit tests. 48 // during unit tests.
49 const OfflinePageItem* GetOfflinePageForTest() const; 49 const OfflinePageItem* GetOfflinePageForTest() const;
50 50
51 private: 51 private:
52 friend class content::WebContentsUserData<OfflinePageTabHelper>; 52 friend class content::WebContentsUserData<OfflinePageTabHelper>;
53 53
54 // Contains the info about the offline page being loaded. 54 // Contains the info about the offline page being loaded.
55 struct LoadedOfflinePageInfo { 55 struct LoadedOfflinePageInfo {
56 LoadedOfflinePageInfo(); 56 LoadedOfflinePageInfo();
57 ~LoadedOfflinePageInfo(); 57 ~LoadedOfflinePageInfo();
58 58
59 // The cached copy of OfflinePageItem. 59 // The cached copy of OfflinePageItem.
60 std::unique_ptr<OfflinePageItem> offline_page; 60 std::unique_ptr<OfflinePageItem> offline_page;
61 61
62 // The offline header that is provided when offline page is loaded. 62 // The offline header that is provided when offline page is loaded.
63 OfflinePageHeader offline_header; 63 OfflinePageHeader offline_header;
64 64
65 // Whether the page is an offline preview. Offline page previews are shown 65 // Whether the page is an offline preview. Offline page previews are shown
66 // when a user's effective connection type is prohibitively slow. 66 // when a user's effective connection type is prohibitively slow.
67 bool is_offline_preview; 67 bool is_showing_offline_preview;
68 68
69 void Clear(); 69 void Clear();
70 }; 70 };
71 71
72 explicit OfflinePageTabHelper(content::WebContents* web_contents); 72 explicit OfflinePageTabHelper(content::WebContents* web_contents);
73 73
74 // Overridden from content::WebContentsObserver: 74 // Overridden from content::WebContentsObserver:
75 void DidStartNavigation( 75 void DidStartNavigation(
76 content::NavigationHandle* navigation_handle) override; 76 content::NavigationHandle* navigation_handle) override;
77 void DidFinishNavigation( 77 void DidFinishNavigation(
(...skipping 15 matching lines...) Expand all
93 bool reloading_url_on_net_error_ = false; 93 bool reloading_url_on_net_error_ = false;
94 94
95 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; 95 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); 97 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper);
98 }; 98 };
99 99
100 } // namespace offline_pages 100 } // namespace offline_pages
101 101
102 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ 102 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698