| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/offline_pages/core/offline_page_model_impl.h" | 5 #include "components/offline_pages/core/offline_page_model_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // If we already have an offline id, use it. If not, generate one. | 364 // If we already have an offline id, use it. If not, generate one. |
| 365 int64_t offline_id = save_page_params.proposed_offline_id; | 365 int64_t offline_id = save_page_params.proposed_offline_id; |
| 366 if (offline_id == kInvalidOfflineId) | 366 if (offline_id == kInvalidOfflineId) |
| 367 offline_id = GenerateOfflineId(); | 367 offline_id = GenerateOfflineId(); |
| 368 | 368 |
| 369 OfflinePageArchiver::CreateArchiveParams create_archive_params; | 369 OfflinePageArchiver::CreateArchiveParams create_archive_params; |
| 370 // If the page is being saved in the background, we should try to remove the | 370 // If the page is being saved in the background, we should try to remove the |
| 371 // popup overlay that obstructs viewing the normal content. | 371 // popup overlay that obstructs viewing the normal content. |
| 372 create_archive_params.remove_popup_overlay = save_page_params.is_background; | 372 create_archive_params.remove_popup_overlay = save_page_params.is_background; |
| 373 create_archive_params.use_page_problem_detectors = |
| 374 save_page_params.use_page_problem_detectors; |
| 373 archiver->CreateArchive( | 375 archiver->CreateArchive( |
| 374 archives_dir_, create_archive_params, | 376 archives_dir_, create_archive_params, |
| 375 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, | 377 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, |
| 376 weak_ptr_factory_.GetWeakPtr(), save_page_params, offline_id, | 378 weak_ptr_factory_.GetWeakPtr(), save_page_params, offline_id, |
| 377 GetCurrentTime(), callback)); | 379 GetCurrentTime(), callback)); |
| 378 pending_archivers_.push_back(std::move(archiver)); | 380 pending_archivers_.push_back(std::move(archiver)); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { | 383 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { |
| 382 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone, | 384 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone, |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 } | 1096 } |
| 1095 | 1097 |
| 1096 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1098 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1097 } | 1099 } |
| 1098 | 1100 |
| 1099 base::Time OfflinePageModelImpl::GetCurrentTime() const { | 1101 base::Time OfflinePageModelImpl::GetCurrentTime() const { |
| 1100 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); | 1102 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); |
| 1101 } | 1103 } |
| 1102 | 1104 |
| 1103 } // namespace offline_pages | 1105 } // namespace offline_pages |
| OLD | NEW |