| 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_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 Loading... |
| 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); | |
| 102 void ReportSnapshotCompleted(); | 101 void ReportSnapshotCompleted(); |
| 103 void ReportDownloadStatusToRequestCoordinator(); | 102 void ReportDownloadStatusToRequestCoordinator(); |
| 104 bool IsSamePage() const; | 103 bool IsSamePage() const; |
| 105 ClientId GetRecentPagesClientId() const; | 104 ClientId GetRecentPagesClientId() const; |
| 106 | 105 |
| 107 // Page model is a service, no ownership. Can be null - for example, in | 106 // Page model is a service, no ownership. Can be null - for example, in |
| 108 // case when tab is in incognito profile. | 107 // case when tab is in incognito profile. |
| 109 OfflinePageModel* page_model_; | 108 OfflinePageModel* page_model_; |
| 110 | 109 |
| 111 // If false, never make snapshots off the attached WebContents. | 110 // If false, never make snapshots off the attached WebContents. |
| 112 // Not page-specific. | 111 // Not page-specific. |
| 113 bool snapshots_enabled_; | 112 bool snapshots_enabled_; |
| 114 | 113 |
| 115 // Becomes true during navigation if the page is ready for snapshot as | 114 // Becomes true during navigation if the page is ready for snapshot as |
| 116 // indicated by at least one callback from SnapshotController. | 115 // indicated by at least one callback from SnapshotController. |
| 117 bool is_page_ready_for_snapshot_; | 116 bool is_page_ready_for_snapshot_; |
| 118 | 117 |
| 119 // Info for the offline page to capture. Null if the tab is not capturing | 118 // Info for the offline page to capture. Null if the tab is not capturing |
| 120 // current page. | 119 // current page. |
| 121 std::unique_ptr<DownloadPageInfo> download_info_; | 120 std::unique_ptr<DownloadPageInfo> download_info_; |
| 122 | 121 |
| 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 | |
| 127 // If empty, the tab does not have AndroidId and can not capture pages. | 122 // If empty, the tab does not have AndroidId and can not capture pages. |
| 128 std::string tab_id_; | 123 std::string tab_id_; |
| 129 | 124 |
| 130 // The URL of the page that is currently being snapshotted. Used to check, | 125 // The URL of the page that is currently being snapshotted. Used to check, |
| 131 // during async operations, that WebContents still contains the same page. | 126 // during async operations, that WebContents still contains the same page. |
| 132 GURL snapshot_url_; | 127 GURL snapshot_url_; |
| 133 // This starts out null and used as a flag for EnsureInitialized() to do the | 128 // This starts out null and used as a flag for EnsureInitialized() to do the |
| 134 // initialization only once. | 129 // initialization only once. |
| 135 std::unique_ptr<SnapshotController> snapshot_controller_; | 130 std::unique_ptr<SnapshotController> snapshot_controller_; |
| 136 | 131 |
| 137 std::unique_ptr<Delegate> delegate_; | 132 std::unique_ptr<Delegate> delegate_; |
| 138 | 133 |
| 139 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; | 134 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; |
| 140 | 135 |
| 141 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); | 136 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); |
| 142 }; | 137 }; |
| 143 | 138 |
| 144 } // namespace offline_pages | 139 } // namespace offline_pages |
| 145 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 140 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
| OLD | NEW |