electron/patches/chromium/notification_provenance.patch
Electron Bot a4de915b74
chore: bump chromium to d66c2e32380bf5d1eb5e1fe37faef (master) (#23791)
* chore: bump chromium in DEPS to db7d7b3e7cb2bc925f2abfde526280cfdfc21a41

* Update patches

* chore: bump chromium in DEPS to 5613e1b99a44fcbe22f3910f803ca76903a77ec1

* Update patches

* Network service: Remove primary_network_context bool.

https://chromium-review.googlesource.com/c/chromium/src/+/2204678

* WebContentsObserver now implements OnRendererResponsive

https://chromium-review.googlesource.com/c/chromium/src/+/2211066

* update patches

* Fixup printing patch

* chore: bump chromium in DEPS to e387b972cdd7160c416fa6c64a724e2258aa0218

* update patches

* [printing] Move PrintHostMsg_DidPrintContent_Params to print.mojom

https://chromium-review.googlesource.com/c/chromium/src/+/2212110

* [XProto] Move items from ::x11::XProto to ::x11

https://chromium-review.googlesource.com/c/chromium/src/+/2218476

* revert Add IChromeAccessible

This was added in https://chromium-review.googlesource.com/c/chromium/src/+/2206224 but it breaks WOA builds because third_party/win_build_output/midl/ui/accessibility/platform/arm64 does not exist. The link above says that the new interface is behind a feature flag which is disabled by default so it is safe to remove for now.

* rebaseline ichromeaccessible for Windows arm64

This patch will not be needed once we get the next roll.

* Update to 1b9e01844e8bf1aaafc4a52c0c62af7f56d9637b to get arm64 fix

* update patches

* chore: bump chromium in DEPS to 096aefa04092ea00f7b68d8d19345883f20db3c3

* chore: bump chromium in DEPS to a524a45ffd1d6fd46a7a86138fe2b22df5b6651a

* chore: update patches

* Window Placement: Gate cross-screen fullscreen behavior on permission

https://chromium-review.googlesource.com/c/chromium/src/+/2203268

* chore: add spec for https://crbug.com/1085836

* chore: bump chromium in DEPS to ff6c4f4b826d66c2e32380bf5d1eb5e1fe37faef

* update patches

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2020-06-01 16:34:34 -04:00

167 lines
9.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <jeremya@chromium.org>
Date: Fri, 5 Oct 2018 14:22:06 -0700
Subject: notification_provenance.patch
Pass RenderProcessHost through to PlatformNotificationService
so Electron can identify which renderer a notification came from.
diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc
index 659149f4c5dea45bead88d26369d8aeb9462b729..7105781e0019b456f287fd0ebb6e309efe2cecad 100644
--- a/content/browser/notifications/blink_notification_service_impl.cc
+++ b/content/browser/notifications/blink_notification_service_impl.cc
@@ -88,9 +88,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl(
PlatformNotificationContextImpl* notification_context,
BrowserContext* browser_context,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderProcessHost* render_process_host,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver)
: notification_context_(notification_context),
+ render_process_host_(render_process_host),
browser_context_(browser_context),
service_worker_context_(std::move(service_worker_context)),
origin_(origin),
@@ -151,8 +153,9 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification(
notification_id, std::move(event_listener_remote));
GetNotificationService(browser_context_)
- ->DisplayNotification(notification_id, origin_.GetURL(),
- platform_notification_data, notification_resources);
+ ->DisplayNotification(render_process_host_, notification_id,
+ origin_.GetURL(), platform_notification_data,
+ notification_resources);
}
void BlinkNotificationServiceImpl::CloseNonPersistentNotification(
diff --git a/content/browser/notifications/blink_notification_service_impl.h b/content/browser/notifications/blink_notification_service_impl.h
index 5253f6be778cc78571b3df0a33d364a9b1e6ef52..dc5307e6500b0bfb5da83e8d8ff8886b91133522 100644
--- a/content/browser/notifications/blink_notification_service_impl.h
+++ b/content/browser/notifications/blink_notification_service_impl.h
@@ -40,6 +40,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl
PlatformNotificationContextImpl* notification_context,
BrowserContext* browser_context,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderProcessHost* render_process_host,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
~BlinkNotificationServiceImpl() override;
@@ -99,6 +100,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl
// The notification context that owns this service instance.
PlatformNotificationContextImpl* notification_context_;
+ RenderProcessHost* render_process_host_;
BrowserContext* browser_context_;
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
diff --git a/content/browser/notifications/blink_notification_service_impl_unittest.cc b/content/browser/notifications/blink_notification_service_impl_unittest.cc
index 619ad99bb52d489826d1e442a7719d985f0696ec..f7c9d3cac66879ce2be06a7a27ea96bfabf3230a 100644
--- a/content/browser/notifications/blink_notification_service_impl_unittest.cc
+++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc
@@ -139,7 +139,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test {
notification_service_ = std::make_unique<BlinkNotificationServiceImpl>(
notification_context_.get(), &browser_context_,
- embedded_worker_helper_->context_wrapper(),
+ embedded_worker_helper_->context_wrapper(), nullptr,
url::Origin::Create(GURL(kTestOrigin)),
notification_service_remote_.BindNewPipeAndPassReceiver());
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
index d221f2747086452c59474f17211adbfeec5a58b0..feee9f0b5f783cb4fbc60d3c29bddfaf5b4b6c46 100644
--- a/content/browser/notifications/platform_notification_context_impl.cc
+++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -208,12 +208,13 @@ void PlatformNotificationContextImpl::Shutdown() {
}
void PlatformNotificationContextImpl::CreateService(
+ RenderProcessHost* render_process_host,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
services_.push_back(std::make_unique<BlinkNotificationServiceImpl>(
- this, browser_context_, service_worker_context_, origin,
- std::move(receiver)));
+ this, browser_context_, service_worker_context_, render_process_host,
+ origin, std::move(receiver)));
}
void PlatformNotificationContextImpl::RemoveService(
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index 4bf25bf1fa69f7d3869369172d375e2e489e62a1..f80ef2cecc8b111dc54e109646573a5978d8ea9c 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -24,6 +24,7 @@
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/platform_notification_context.h"
+#include "content/public/browser/render_process_host.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "third_party/blink/public/mojom/notifications/notification_service.mojom.h"
@@ -67,6 +68,7 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Creates a BlinkNotificationServiceImpl that is owned by this context.
void CreateService(
+ RenderProcessHost* render_process_host,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 49af7bd3719fe3c9848050f3f336bc02cfbfd2fb..f33eb6d5a0e98e06cd3ba318e9b578df4bc9ab2c 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2120,7 +2120,7 @@ void RenderProcessHostImpl::CreateNotificationService(
mojo::PendingReceiver<blink::mojom::NotificationService> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
- origin, std::move(receiver));
+ this, origin, std::move(receiver));
}
void RenderProcessHostImpl::CreateWebSocketConnector(
diff --git a/content/public/browser/platform_notification_service.h b/content/public/browser/platform_notification_service.h
index ca61088079c4150fcf389504ddcf26bcf6bf69cd..d9c034c39890eef1fe3d95c6d7c0ae68eb711a89 100644
--- a/content/public/browser/platform_notification_service.h
+++ b/content/public/browser/platform_notification_service.h
@@ -27,6 +27,8 @@ struct PlatformNotificationData;
namespace content {
+class RenderProcessHost;
+
// The service using which notifications can be presented to the user. There
// should be a unique instance of the PlatformNotificationService depending
// on the browsing context being used.
@@ -41,6 +43,7 @@ class CONTENT_EXPORT PlatformNotificationService {
// Displays the notification described in |notification_data| to the user.
// This method must be called on the UI thread.
virtual void DisplayNotification(
+ RenderProcessHost* render_process_host,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
diff --git a/content/test/mock_platform_notification_service.cc b/content/test/mock_platform_notification_service.cc
index 639a93ac8d4f295910fcfb64d69d1498c9dbbe94..25d7b29b53b426d02664bc904f1c646662d9a5d5 100644
--- a/content/test/mock_platform_notification_service.cc
+++ b/content/test/mock_platform_notification_service.cc
@@ -30,6 +30,7 @@ MockPlatformNotificationService::MockPlatformNotificationService(
MockPlatformNotificationService::~MockPlatformNotificationService() = default;
void MockPlatformNotificationService::DisplayNotification(
+ RenderProcessHost* render_process_host,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
diff --git a/content/test/mock_platform_notification_service.h b/content/test/mock_platform_notification_service.h
index 6d108f9884f7e8f608b70ec33d286a06346e7456..4650a01c2d090c5957eb7a7e21f124489513142a 100644
--- a/content/test/mock_platform_notification_service.h
+++ b/content/test/mock_platform_notification_service.h
@@ -47,6 +47,7 @@ class MockPlatformNotificationService : public PlatformNotificationService {
// PlatformNotificationService implementation.
void DisplayNotification(
+ RenderProcessHost* render_process_host,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,