| 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 return; | 348 return; |
| 349 } | 349 } |
| 350 | 350 |
| 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 = snapshot_url_; | 354 save_page_params.url = snapshot_url_; |
| 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 std::vector<std::string> signal_data; |
| 358 page_model_->SavePage( | 359 page_model_->SavePage( |
| 359 save_page_params, delegate_->CreatePageArchiver(web_contents()), | 360 save_page_params, delegate_->CreatePageArchiver(web_contents()), |
| 361 signal_data, |
| 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() || |
| 368 snapshot_info->request_id == offline_id); | 370 snapshot_info->request_id == offline_id); |
| 369 ReportSnapshotCompleted(snapshot_info, result == SavePageResult::SUCCESS); | 371 ReportSnapshotCompleted(snapshot_info, result == SavePageResult::SUCCESS); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 426 } |
| 425 | 427 |
| 426 void RecentTabHelper::CancelInFlightSnapshots() { | 428 void RecentTabHelper::CancelInFlightSnapshots() { |
| 427 weak_ptr_factory_.InvalidateWeakPtrs(); | 429 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 428 downloads_ongoing_snapshot_info_.reset(); | 430 downloads_ongoing_snapshot_info_.reset(); |
| 429 downloads_latest_saved_snapshot_info_.reset(); | 431 downloads_latest_saved_snapshot_info_.reset(); |
| 430 last_n_ongoing_snapshot_info_.reset(); | 432 last_n_ongoing_snapshot_info_.reset(); |
| 431 } | 433 } |
| 432 | 434 |
| 433 } // namespace offline_pages | 435 } // namespace offline_pages |
| OLD | NEW |