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

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

Issue 2295593002: [Offline Pages] Check for the appropriate namespace when showing notifications. (Closed)
Patch Set: Add comment. Created 4 years, 4 months 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 271b4af6747a41ddfa725508333732d1a86ce72d..483303627a5a323a37e2bdb06e1e284936f5a146 100644
--- a/components/offline_pages/downloads/download_notifying_observer.cc
+++ b/components/offline_pages/downloads/download_notifying_observer.cc
@@ -6,6 +6,7 @@
#include "components/offline_pages/background/request_coordinator.h"
#include "components/offline_pages/background/save_page_request.h"
+#include "components/offline_pages/downloads/download_ui_adapter.h"
#include "components/offline_pages/downloads/offline_page_download_notifier.h"
namespace offline_pages {
@@ -42,11 +43,15 @@ void DownloadNotifyingObserver::CreateAndStartObserving(
void DownloadNotifyingObserver::OnAdded(const SavePageRequest& request) {
DCHECK(notifier_.get());
+ if (!DownloadUIAdapter::IsVisibleInUI(request.client_id()))
+ return;
notifier_->NotifyDownloadProgress(DownloadUIItem(request));
}
void DownloadNotifyingObserver::OnChanged(const SavePageRequest& request) {
DCHECK(notifier_.get());
+ if (!DownloadUIAdapter::IsVisibleInUI(request.client_id()))
+ return;
if (request.request_state() == SavePageRequest::RequestState::PAUSED)
notifier_->NotifyDownloadPaused(DownloadUIItem(request));
else
@@ -57,6 +62,8 @@ void DownloadNotifyingObserver::OnCompleted(
const SavePageRequest& request,
RequestCoordinator::SavePageStatus status) {
DCHECK(notifier_.get());
+ if (!DownloadUIAdapter::IsVisibleInUI(request.client_id()))
+ return;
if (status == RequestCoordinator::SavePageStatus::SUCCESS)
notifier_->NotifyDownloadSuccessful(DownloadUIItem(request));
else if (status == RequestCoordinator::SavePageStatus::REMOVED)
« 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