| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 385 } |
| 386 | 386 |
| 387 DCHECK(OfflinePageModel::CanSaveURL(web_contents()->GetLastCommittedURL())); | 387 DCHECK(OfflinePageModel::CanSaveURL(web_contents()->GetLastCommittedURL())); |
| 388 snapshot_info->expected_page_quality = | 388 snapshot_info->expected_page_quality = |
| 389 snapshot_controller_->current_page_quality(); | 389 snapshot_controller_->current_page_quality(); |
| 390 OfflinePageModel::SavePageParams save_page_params; | 390 OfflinePageModel::SavePageParams save_page_params; |
| 391 save_page_params.url = web_contents()->GetLastCommittedURL(); | 391 save_page_params.url = web_contents()->GetLastCommittedURL(); |
| 392 save_page_params.client_id = snapshot_info->client_id; | 392 save_page_params.client_id = snapshot_info->client_id; |
| 393 save_page_params.proposed_offline_id = snapshot_info->request_id; | 393 save_page_params.proposed_offline_id = snapshot_info->request_id; |
| 394 save_page_params.is_background = false; | 394 save_page_params.is_background = false; |
| 395 save_page_params.original_url = |
| 396 OfflinePageUtils::GetOriginalURLFromWebContents(web_contents()); |
| 395 page_model_->SavePage( | 397 page_model_->SavePage( |
| 396 save_page_params, delegate_->CreatePageArchiver(web_contents()), | 398 save_page_params, delegate_->CreatePageArchiver(web_contents()), |
| 397 base::Bind(&RecentTabHelper::SavePageCallback, | 399 base::Bind(&RecentTabHelper::SavePageCallback, |
| 398 weak_ptr_factory_.GetWeakPtr(), snapshot_info)); | 400 weak_ptr_factory_.GetWeakPtr(), snapshot_info)); |
| 399 } | 401 } |
| 400 | 402 |
| 401 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info, | 403 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info, |
| 402 OfflinePageModel::SavePageResult result, | 404 OfflinePageModel::SavePageResult result, |
| 403 int64_t offline_id) { | 405 int64_t offline_id) { |
| 404 DCHECK(snapshot_info->IsForLastN() || | 406 DCHECK(snapshot_info->IsForLastN() || |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 } | 465 } |
| 464 | 466 |
| 465 void RecentTabHelper::CancelInFlightSnapshots() { | 467 void RecentTabHelper::CancelInFlightSnapshots() { |
| 466 weak_ptr_factory_.InvalidateWeakPtrs(); | 468 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 467 downloads_ongoing_snapshot_info_.reset(); | 469 downloads_ongoing_snapshot_info_.reset(); |
| 468 downloads_latest_saved_snapshot_info_.reset(); | 470 downloads_latest_saved_snapshot_info_.reset(); |
| 469 last_n_ongoing_snapshot_info_.reset(); | 471 last_n_ongoing_snapshot_info_.reset(); |
| 470 } | 472 } |
| 471 | 473 |
| 472 } // namespace offline_pages | 474 } // namespace offline_pages |
| OLD | NEW |