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

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

Issue 2542833003: Failed offline snapshots won't erase a successful one from the same page load. (Closed)
Patch Set: Fix link error and address reviewer comments. Created 4 years 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/recent_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_RECENT_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 91 };
92 92
93 explicit RecentTabHelper(content::WebContents* web_contents); 93 explicit RecentTabHelper(content::WebContents* web_contents);
94 friend class content::WebContentsUserData<RecentTabHelper>; 94 friend class content::WebContentsUserData<RecentTabHelper>;
95 95
96 void EnsureInitialized(); 96 void EnsureInitialized();
97 void ContinueSnapshotWithIdsToPurge(const std::vector<int64_t>& page_ids); 97 void ContinueSnapshotWithIdsToPurge(const std::vector<int64_t>& page_ids);
98 void ContinueSnapshotAfterPurge(OfflinePageModel::DeletePageResult result); 98 void ContinueSnapshotAfterPurge(OfflinePageModel::DeletePageResult result);
99 void SavePageCallback(OfflinePageModel::SavePageResult result, 99 void SavePageCallback(OfflinePageModel::SavePageResult result,
100 int64_t offline_id); 100 int64_t offline_id);
101 void PreviousSaveWasPurged(OfflinePageModel::DeletePageResult result);
101 void ReportSnapshotCompleted(); 102 void ReportSnapshotCompleted();
102 void ReportDownloadStatusToRequestCoordinator(); 103 void ReportDownloadStatusToRequestCoordinator();
103 bool IsSamePage() const; 104 bool IsSamePage() const;
104 ClientId GetRecentPagesClientId() const; 105 ClientId GetRecentPagesClientId() const;
105 106
106 // Page model is a service, no ownership. Can be null - for example, in 107 // Page model is a service, no ownership. Can be null - for example, in
107 // case when tab is in incognito profile. 108 // case when tab is in incognito profile.
108 OfflinePageModel* page_model_; 109 OfflinePageModel* page_model_;
109 110
110 // If false, never make snapshots off the attached WebContents. 111 // If false, never make snapshots off the attached WebContents.
111 // Not page-specific. 112 // Not page-specific.
112 bool snapshots_enabled_; 113 bool snapshots_enabled_;
113 114
114 // Becomes true during navigation if the page is ready for snapshot as 115 // Becomes true during navigation if the page is ready for snapshot as
115 // indicated by at least one callback from SnapshotController. 116 // indicated by at least one callback from SnapshotController.
116 bool is_page_ready_for_snapshot_; 117 bool is_page_ready_for_snapshot_;
117 118
118 // Info for the offline page to capture. Null if the tab is not capturing 119 // Info for the offline page to capture. Null if the tab is not capturing
119 // current page. 120 // current page.
120 std::unique_ptr<DownloadPageInfo> download_info_; 121 std::unique_ptr<DownloadPageInfo> download_info_;
121 122
123 // Stores the request/offline ID of successful snapshots that happened during
124 // a single ongoing page load.
125 int64_t previous_request_id_for_load_;
126
122 // If empty, the tab does not have AndroidId and can not capture pages. 127 // If empty, the tab does not have AndroidId and can not capture pages.
123 std::string tab_id_; 128 std::string tab_id_;
124 129
125 // The URL of the page that is currently being snapshotted. Used to check, 130 // The URL of the page that is currently being snapshotted. Used to check,
126 // during async operations, that WebContents still contains the same page. 131 // during async operations, that WebContents still contains the same page.
127 GURL snapshot_url_; 132 GURL snapshot_url_;
128 // This starts out null and used as a flag for EnsureInitialized() to do the 133 // This starts out null and used as a flag for EnsureInitialized() to do the
129 // initialization only once. 134 // initialization only once.
130 std::unique_ptr<SnapshotController> snapshot_controller_; 135 std::unique_ptr<SnapshotController> snapshot_controller_;
131 136
132 std::unique_ptr<Delegate> delegate_; 137 std::unique_ptr<Delegate> delegate_;
133 138
134 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; 139 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_;
135 140
136 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); 141 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper);
137 }; 142 };
138 143
139 } // namespace offline_pages 144 } // namespace offline_pages
140 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ 145 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/recent_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698