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

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

Issue 2245213002: Add PageLoad.* metrics for Offline Previews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: csharrison comments Created 4 years, 4 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Prohibitively slow means that the NetworkQualityEstimator reported a 61 // Prohibitively slow means that the NetworkQualityEstimator reported a
62 // connection slow enough to warrant showing an offline page if available. 62 // connection slow enough to warrant showing an offline page if available.
63 REDIRECTED_ON_PROHIBITIVELY_SLOW_NETWORK = 10, 63 REDIRECTED_ON_PROHIBITIVELY_SLOW_NETWORK = 10,
64 PAGE_NOT_FOUND_ON_PROHIBITIVELY_SLOW_NETWORK = 11, 64 PAGE_NOT_FOUND_ON_PROHIBITIVELY_SLOW_NETWORK = 11,
65 PAGE_NOT_FRESH_ON_PROHIBITIVELY_SLOW_NETWORK = 12, 65 PAGE_NOT_FRESH_ON_PROHIBITIVELY_SLOW_NETWORK = 12,
66 REDIRECT_RESULT_MAX, 66 REDIRECT_RESULT_MAX,
67 }; 67 };
68 68
69 ~OfflinePageTabHelper() override; 69 ~OfflinePageTabHelper() override;
70 70
71 const OfflinePageItem* offline_page() { return offline_page_.get(); } 71 const OfflinePageItem* offline_page() const { return offline_page_.get(); }
72
73 // Whether the page is an offline preview.
74 bool is_offline_preview() const { return is_offline_preview_; }
72 75
73 private: 76 private:
74 friend class content::WebContentsUserData<OfflinePageTabHelper>; 77 friend class content::WebContentsUserData<OfflinePageTabHelper>;
75 friend class OfflinePageTabHelperTest; 78 friend class OfflinePageTabHelperTest;
76 FRIEND_TEST_ALL_PREFIXES(OfflinePageTabHelperTest, 79 FRIEND_TEST_ALL_PREFIXES(OfflinePageTabHelperTest,
77 NewNavigationCancelsPendingRedirects); 80 NewNavigationCancelsPendingRedirects);
78 81
79 explicit OfflinePageTabHelper(content::WebContents* web_contents); 82 explicit OfflinePageTabHelper(content::WebContents* web_contents);
80 83
81 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); 84 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate);
(...skipping 28 matching lines...) Expand all
110 bool IsInRedirectLoop(const GURL& to_url) const; 113 bool IsInRedirectLoop(const GURL& to_url) const;
111 114
112 void ReportRedirectResultUMA(RedirectResult result); 115 void ReportRedirectResultUMA(RedirectResult result);
113 116
114 // Iff the tab we are associated with is redirected to an offline page, 117 // Iff the tab we are associated with is redirected to an offline page,
115 // |offline_page_| will be non-null. This can be used to synchronously ask 118 // |offline_page_| will be non-null. This can be used to synchronously ask
116 // about the offline state of the current web contents. 119 // about the offline state of the current web contents.
117 std::unique_ptr<OfflinePageItem> offline_page_; 120 std::unique_ptr<OfflinePageItem> offline_page_;
118 std::unique_ptr<Delegate> delegate_; 121 std::unique_ptr<Delegate> delegate_;
119 122
123 // Whether the page is an offline preview. Offline page previews are shown
124 // when a user's effective connection type is prohibitively slow.
125 bool is_offline_preview_;
126
120 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_; 127 base::WeakPtrFactory<OfflinePageTabHelper> weak_ptr_factory_;
121 128
122 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper); 129 DISALLOW_COPY_AND_ASSIGN(OfflinePageTabHelper);
123 }; 130 };
124 131
125 } // namespace offline_pages 132 } // namespace offline_pages
126 133
127 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_ 134 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_TAB_HELPER_H_
OLDNEW
« 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