| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (!snapshots_enabled_) | 145 if (!snapshots_enabled_) |
| 146 return; | 146 return; |
| 147 | 147 |
| 148 // We navigated to a different page, lets report progress to Background | 148 // We navigated to a different page, lets report progress to Background |
| 149 // Offliner. | 149 // Offliner. |
| 150 if (download_info_ && !navigation_handle->IsSamePage()) { | 150 if (download_info_ && !navigation_handle->IsSamePage()) { |
| 151 ReportDownloadStatusToRequestCoordinator(); | 151 ReportDownloadStatusToRequestCoordinator(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 if (offline_pages::IsOffliningRecentPagesEnabled()) { | 154 if (offline_pages::IsOffliningRecentPagesEnabled()) { |
| 155 int64_t proposed_id = OfflinePageModel::kInvalidOfflineId; | |
| 156 download_info_ = base::MakeUnique<DownloadPageInfo>( | 155 download_info_ = base::MakeUnique<DownloadPageInfo>( |
| 157 GetRecentPagesClientId(), proposed_id); | 156 GetRecentPagesClientId(), OfflinePageModel::kInvalidOfflineId); |
| 158 } else { | 157 } else { |
| 159 download_info_.reset(); | 158 download_info_.reset(); |
| 160 } | 159 } |
| 161 | 160 |
| 162 is_page_ready_for_snapshot_ = false; | 161 is_page_ready_for_snapshot_ = false; |
| 163 | 162 |
| 164 // New navigation, new snapshot session. | 163 // New navigation, new snapshot session. |
| 165 snapshot_url_ = web_contents()->GetLastCommittedURL(); | 164 snapshot_url_ = web_contents()->GetLastCommittedURL(); |
| 166 | 165 |
| 167 // Check for conditions that would cause us not to snapshot. | 166 // Check for conditions that would cause us not to snapshot. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 bool RecentTabHelper::IsSamePage() const { | 293 bool RecentTabHelper::IsSamePage() const { |
| 295 return web_contents() && | 294 return web_contents() && |
| 296 (web_contents()->GetLastCommittedURL() == snapshot_url_); | 295 (web_contents()->GetLastCommittedURL() == snapshot_url_); |
| 297 } | 296 } |
| 298 | 297 |
| 299 ClientId RecentTabHelper::GetRecentPagesClientId() const { | 298 ClientId RecentTabHelper::GetRecentPagesClientId() const { |
| 300 return ClientId(kLastNNamespace, tab_id_); | 299 return ClientId(kLastNNamespace, tab_id_); |
| 301 } | 300 } |
| 302 | 301 |
| 303 } // namespace offline_pages | 302 } // namespace offline_pages |
| OLD | NEW |