| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 page_model_ = OfflinePageModelFactory::GetForBrowserContext( | 182 page_model_ = OfflinePageModelFactory::GetForBrowserContext( |
| 183 web_contents()->GetBrowserContext()); | 183 web_contents()->GetBrowserContext()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 return snapshots_enabled_; | 186 return snapshots_enabled_; |
| 187 } | 187 } |
| 188 | 188 |
| 189 void RecentTabHelper::DidFinishNavigation( | 189 void RecentTabHelper::DidFinishNavigation( |
| 190 content::NavigationHandle* navigation_handle) { | 190 content::NavigationHandle* navigation_handle) { |
| 191 if (!navigation_handle->IsInMainFrame() || | 191 if (!navigation_handle->IsInMainFrame() || |
| 192 !navigation_handle->HasCommitted() || navigation_handle->IsSamePage()) { | 192 !navigation_handle->HasCommitted() || |
| 193 navigation_handle->IsSameDocument()) { |
| 193 DVLOG_IF(1, navigation_handle->IsInMainFrame()) | 194 DVLOG_IF(1, navigation_handle->IsInMainFrame()) |
| 194 << "Main frame navigation ignored (reasons: " | 195 << "Main frame navigation ignored (reasons: " |
| 195 << !navigation_handle->HasCommitted() << ", " | 196 << !navigation_handle->HasCommitted() << ", " |
| 196 << navigation_handle->IsSamePage() | 197 << navigation_handle->IsSameDocument() |
| 197 << ") to: " << web_contents()->GetLastCommittedURL().spec(); | 198 << ") to: " << web_contents()->GetLastCommittedURL().spec(); |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 | 201 |
| 201 if (!EnsureInitialized()) | 202 if (!EnsureInitialized()) |
| 202 return; | 203 return; |
| 203 DVLOG(1) << "Navigation acknowledged to: " | 204 DVLOG(1) << "Navigation acknowledged to: " |
| 204 << web_contents()->GetLastCommittedURL().spec(); | 205 << web_contents()->GetLastCommittedURL().spec(); |
| 205 | 206 |
| 206 // If there is an ongoing downloads request, lets make Background Offliner | 207 // If there is an ongoing downloads request, lets make Background Offliner |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 474 } |
| 474 | 475 |
| 475 void RecentTabHelper::CancelInFlightSnapshots() { | 476 void RecentTabHelper::CancelInFlightSnapshots() { |
| 476 weak_ptr_factory_.InvalidateWeakPtrs(); | 477 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 477 downloads_ongoing_snapshot_info_.reset(); | 478 downloads_ongoing_snapshot_info_.reset(); |
| 478 downloads_latest_saved_snapshot_info_.reset(); | 479 downloads_latest_saved_snapshot_info_.reset(); |
| 479 last_n_ongoing_snapshot_info_.reset(); | 480 last_n_ongoing_snapshot_info_.reset(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 } // namespace offline_pages | 483 } // namespace offline_pages |
| OLD | NEW |