| 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/offline_page_model_impl.h" | 5 #include "components/offline_pages/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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 350 } |
| 351 | 351 |
| 352 // The web contents is not available if archiver is not created and passed. | 352 // The web contents is not available if archiver is not created and passed. |
| 353 if (!archiver.get()) { | 353 if (!archiver.get()) { |
| 354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, | 354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, |
| 355 kInvalidOfflineId); | 355 kInvalidOfflineId); |
| 356 return; | 356 return; |
| 357 } | 357 } |
| 358 | 358 |
| 359 // If we already have an offline id, use it. If not, generate one. | 359 // If we already have an offline id, use it. If not, generate one. |
| 360 if (proposed_offline_id == 0l) | 360 if (proposed_offline_id == kInvalidOfflineId) |
| 361 proposed_offline_id = GenerateOfflineId(); | 361 proposed_offline_id = GenerateOfflineId(); |
| 362 | 362 |
| 363 archiver->CreateArchive( | 363 archiver->CreateArchive( |
| 364 archives_dir_, proposed_offline_id, | 364 archives_dir_, proposed_offline_id, |
| 365 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, | 365 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, |
| 366 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id, | 366 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id, |
| 367 client_id, GetCurrentTime(), callback)); | 367 client_id, GetCurrentTime(), callback)); |
| 368 pending_archivers_.push_back(std::move(archiver)); | 368 pending_archivers_.push_back(std::move(archiver)); |
| 369 } | 369 } |
| 370 | 370 |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1050 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 base::Time OfflinePageModelImpl::GetCurrentTime() const { | 1053 base::Time OfflinePageModelImpl::GetCurrentTime() const { |
| 1054 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); | 1054 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 } // namespace offline_pages | 1057 } // namespace offline_pages |
| OLD | NEW |