| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 348 } |
| 349 | 349 |
| 350 DCHECK(OfflinePageModel::CanSaveURL(web_contents()->GetLastCommittedURL())); | 350 DCHECK(OfflinePageModel::CanSaveURL(web_contents()->GetLastCommittedURL())); |
| 351 snapshot_info->expected_page_quality = | 351 snapshot_info->expected_page_quality = |
| 352 snapshot_controller_->current_page_quality(); | 352 snapshot_controller_->current_page_quality(); |
| 353 OfflinePageModel::SavePageParams save_page_params; | 353 OfflinePageModel::SavePageParams save_page_params; |
| 354 save_page_params.url = web_contents()->GetLastCommittedURL(); | 354 save_page_params.url = web_contents()->GetLastCommittedURL(); |
| 355 save_page_params.client_id = snapshot_info->client_id; | 355 save_page_params.client_id = snapshot_info->client_id; |
| 356 save_page_params.proposed_offline_id = snapshot_info->request_id; | 356 save_page_params.proposed_offline_id = snapshot_info->request_id; |
| 357 save_page_params.is_background = false; | 357 save_page_params.is_background = false; |
| 358 save_page_params.original_url = |
| 359 OfflinePageUtils::GetOriginalURLFromWebContents(web_contents()); |
| 358 page_model_->SavePage( | 360 page_model_->SavePage( |
| 359 save_page_params, delegate_->CreatePageArchiver(web_contents()), | 361 save_page_params, delegate_->CreatePageArchiver(web_contents()), |
| 360 base::Bind(&RecentTabHelper::SavePageCallback, | 362 base::Bind(&RecentTabHelper::SavePageCallback, |
| 361 weak_ptr_factory_.GetWeakPtr(), snapshot_info)); | 363 weak_ptr_factory_.GetWeakPtr(), snapshot_info)); |
| 362 } | 364 } |
| 363 | 365 |
| 364 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info, | 366 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info, |
| 365 OfflinePageModel::SavePageResult result, | 367 OfflinePageModel::SavePageResult result, |
| 366 int64_t offline_id) { | 368 int64_t offline_id) { |
| 367 DCHECK(snapshot_info->IsForLastN() || | 369 DCHECK(snapshot_info->IsForLastN() || |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } | 425 } |
| 424 | 426 |
| 425 void RecentTabHelper::CancelInFlightSnapshots() { | 427 void RecentTabHelper::CancelInFlightSnapshots() { |
| 426 weak_ptr_factory_.InvalidateWeakPtrs(); | 428 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 427 downloads_ongoing_snapshot_info_.reset(); | 429 downloads_ongoing_snapshot_info_.reset(); |
| 428 downloads_latest_saved_snapshot_info_.reset(); | 430 downloads_latest_saved_snapshot_info_.reset(); |
| 429 last_n_ongoing_snapshot_info_.reset(); | 431 last_n_ongoing_snapshot_info_.reset(); |
| 430 } | 432 } |
| 431 | 433 |
| 432 } // namespace offline_pages | 434 } // namespace offline_pages |
| OLD | NEW |