Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: components/offline_pages/downloads/download_notifying_observer.cc

Issue 2521353005: [OfflinePages] Call NotifyInterrupted for pending requests (Closed)
Patch Set: Another option for OnAdded Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/offline_pages/downloads/download_notifying_observer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/downloads/download_notifying_observer.cc
diff --git a/components/offline_pages/downloads/download_notifying_observer.cc b/components/offline_pages/downloads/download_notifying_observer.cc
index 397bcc975a867fbd9fff675cb620921857ca9662..a2e8d98ce64a5102d9c6e1b85f87aa87cb2eb2ac 100644
--- a/components/offline_pages/downloads/download_notifying_observer.cc
+++ b/components/offline_pages/downloads/download_notifying_observer.cc
@@ -47,7 +47,16 @@ void DownloadNotifyingObserver::OnAdded(const SavePageRequest& request) {
DCHECK(notifier_.get());
if (!IsVisibleInUI(request.client_id()))
return;
+
+ // There is no Added call for the notifier so we perform a Progress call
+ // to cause the notification to be created.
notifier_->NotifyDownloadProgress(DownloadUIItem(request));
+
+ // Now if the request state is available, we need to send Interrupted call.
+ // TODO(dougarnett): Handle request state in notifier impl so this call
+ // is not needed.
+ if (request.request_state() == SavePageRequest::RequestState::AVAILABLE)
fgorski 2016/11/28 22:30:24 Here is the response to your previous comment that
dougarnett 2016/11/28 22:52:15 Done. Btw, chatted with Min and he does suggest g
+ notifier_->NotifyDownloadInterrupted(DownloadUIItem(request));
}
void DownloadNotifyingObserver::OnChanged(const SavePageRequest& request) {
@@ -56,6 +65,8 @@ void DownloadNotifyingObserver::OnChanged(const SavePageRequest& request) {
return;
if (request.request_state() == SavePageRequest::RequestState::PAUSED)
notifier_->NotifyDownloadPaused(DownloadUIItem(request));
+ else if (request.request_state() == SavePageRequest::RequestState::AVAILABLE)
+ notifier_->NotifyDownloadInterrupted(DownloadUIItem(request));
else
notifier_->NotifyDownloadProgress(DownloadUIItem(request));
}
« no previous file with comments | « no previous file | components/offline_pages/downloads/download_notifying_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698