| 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/downloads/download_notifying_observer.h" | 5 #include "components/offline_pages/downloads/download_notifying_observer.h" |
| 6 | 6 |
| 7 #include "components/offline_pages/background/request_coordinator.h" | 7 #include "components/offline_pages/background/request_coordinator.h" |
| 8 #include "components/offline_pages/background/save_page_request.h" | 8 #include "components/offline_pages/background/save_page_request.h" |
| 9 #include "components/offline_pages/downloads/download_ui_adapter.h" | 9 #include "components/offline_pages/downloads/download_ui_adapter.h" |
| 10 #include "components/offline_pages/downloads/offline_page_download_notifier.h" | 10 #include "components/offline_pages/downloads/offline_page_download_notifier.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (!DownloadUIAdapter::IsVisibleInUI(request.client_id())) | 53 if (!DownloadUIAdapter::IsVisibleInUI(request.client_id())) |
| 54 return; | 54 return; |
| 55 if (request.request_state() == SavePageRequest::RequestState::PAUSED) | 55 if (request.request_state() == SavePageRequest::RequestState::PAUSED) |
| 56 notifier_->NotifyDownloadPaused(DownloadUIItem(request)); | 56 notifier_->NotifyDownloadPaused(DownloadUIItem(request)); |
| 57 else | 57 else |
| 58 notifier_->NotifyDownloadProgress(DownloadUIItem(request)); | 58 notifier_->NotifyDownloadProgress(DownloadUIItem(request)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void DownloadNotifyingObserver::OnCompleted( | 61 void DownloadNotifyingObserver::OnCompleted( |
| 62 const SavePageRequest& request, | 62 const SavePageRequest& request, |
| 63 RequestCoordinator::SavePageStatus status) { | 63 RequestCoordinator::BackgroundSavePageResult status) { |
| 64 DCHECK(notifier_.get()); | 64 DCHECK(notifier_.get()); |
| 65 if (!DownloadUIAdapter::IsVisibleInUI(request.client_id())) | 65 if (!DownloadUIAdapter::IsVisibleInUI(request.client_id())) |
| 66 return; | 66 return; |
| 67 if (status == RequestCoordinator::SavePageStatus::SUCCESS) | 67 if (status == RequestCoordinator::BackgroundSavePageResult::SUCCESS) |
| 68 notifier_->NotifyDownloadSuccessful(DownloadUIItem(request)); | 68 notifier_->NotifyDownloadSuccessful(DownloadUIItem(request)); |
| 69 else if (status == RequestCoordinator::SavePageStatus::REMOVED) | 69 else if (status == RequestCoordinator::BackgroundSavePageResult::REMOVED) |
| 70 notifier_->NotifyDownloadCanceled(DownloadUIItem(request)); | 70 notifier_->NotifyDownloadCanceled(DownloadUIItem(request)); |
| 71 else | 71 else |
| 72 notifier_->NotifyDownloadFailed(DownloadUIItem(request)); | 72 notifier_->NotifyDownloadFailed(DownloadUIItem(request)); |
| 73 } | 73 } |
| 74 } // namespace offline_pages | 74 } // namespace offline_pages |
| OLD | NEW |