| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 | 290 |
| 291 // The web contents is not available if archiver is not created and passed. | 291 // The web contents is not available if archiver is not created and passed. |
| 292 if (!archiver.get()) { | 292 if (!archiver.get()) { |
| 293 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, | 293 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, |
| 294 kInvalidOfflineId); | 294 kInvalidOfflineId); |
| 295 return; | 295 return; |
| 296 } | 296 } |
| 297 | 297 |
| 298 // If we already have an offline id, use it. If not, generate one. | 298 // If we already have an offline id, use it. If not, generate one. |
| 299 if (proposed_offline_id == 0ul) | 299 if (proposed_offline_id == 0l) |
| 300 proposed_offline_id = GenerateOfflineId(); | 300 proposed_offline_id = GenerateOfflineId(); |
| 301 | 301 |
| 302 archiver->CreateArchive( | 302 archiver->CreateArchive( |
| 303 archives_dir_, proposed_offline_id, | 303 archives_dir_, proposed_offline_id, |
| 304 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, | 304 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, |
| 305 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id, | 305 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id, |
| 306 client_id, base::Time::Now(), callback)); | 306 client_id, base::Time::Now(), callback)); |
| 307 pending_archivers_.push_back(std::move(archiver)); | 307 pending_archivers_.push_back(std::move(archiver)); |
| 308 } | 308 } |
| 309 | 309 |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { | 1070 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { |
| 1071 if (!is_loaded_) { | 1071 if (!is_loaded_) { |
| 1072 delayed_tasks_.push_back(task); | 1072 delayed_tasks_.push_back(task); |
| 1073 return; | 1073 return; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1076 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 } // namespace offline_pages | 1079 } // namespace offline_pages |
| OLD | NEW |