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

Unified Diff: chrome/browser/android/offline_pages/recent_tab_helper.h

Issue 2635023005: Minor improvements to RecentTabHelper. (Closed)
Patch Set: Removed unneeded DCHECK_CURRENTLY_ON. Created 3 years, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/recent_tab_helper.h
diff --git a/chrome/browser/android/offline_pages/recent_tab_helper.h b/chrome/browser/android/offline_pages/recent_tab_helper.h
index 94c69e4ff1bd586eb30f75bfb41957955e2ebe7a..0095404ee3c2a43a7b3847c7a2b6628a8ec22f81 100644
--- a/chrome/browser/android/offline_pages/recent_tab_helper.h
+++ b/chrome/browser/android/offline_pages/recent_tab_helper.h
@@ -71,23 +71,29 @@ class RecentTabHelper
private:
// Keeps client_id/request_id that will be used for the offline snapshot.
- struct DownloadPageInfo {
+ struct SnapshotProgressInfo {
public:
- DownloadPageInfo(const ClientId& client_id,
- int64_t request_id)
- : client_id_(client_id),
- request_id_(request_id),
- page_snapshot_completed_(false) {}
+ // For a downloads snapshot request, where the |request_id| is defined.
+ SnapshotProgressInfo(const ClientId& client_id, int64_t request_id)
+ : client_id(client_id), request_id(request_id) {}
+
+ // For a last_n snapshot request.
+ explicit SnapshotProgressInfo(const ClientId& client_id)
+ : client_id(client_id) {}
+
+ bool IsForLastN();
// The ClientID to go with the offline page.
- ClientId client_id_;
+ ClientId client_id;
+
// Id of the suspended request in Background Offliner. Used to un-suspend
// the request if the capture of the current page was not possible (e.g.
// the user navigated to another page before current one was loaded).
- // 0 if this is a "last_1" info.
- int64_t request_id_;
+ // 0 if this is a "last_n" info.
+ int64_t request_id = OfflinePageModel::kInvalidOfflineId;
+
// True if there was at least one snapshot successfully completed.
- bool page_snapshot_completed_;
+ bool page_snapshot_completed = false;
};
explicit RecentTabHelper(content::WebContents* web_contents);
@@ -105,19 +111,19 @@ class RecentTabHelper
// Page model is a service, no ownership. Can be null - for example, in
// case when tab is in incognito profile.
- OfflinePageModel* page_model_;
+ OfflinePageModel* page_model_ = nullptr;
// If false, never make snapshots off the attached WebContents.
// Not page-specific.
- bool snapshots_enabled_;
+ bool snapshots_enabled_ = false;
// Becomes true during navigation if the page is ready for snapshot as
// indicated by at least one callback from SnapshotController.
- bool is_page_ready_for_snapshot_;
+ bool is_page_ready_for_snapshot_ = false;
// Info for the offline page to capture. Null if the tab is not capturing
// current page.
- std::unique_ptr<DownloadPageInfo> download_info_;
+ std::unique_ptr<SnapshotProgressInfo> snapshot_info_;
// If empty, the tab does not have AndroidId and can not capture pages.
std::string tab_id_;
@@ -137,4 +143,5 @@ class RecentTabHelper
};
} // namespace offline_pages
+
#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
« 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