electron/patches/chromium/notification_provenance.patch
Electron Bot ca75bca667
chore: bump chromium to 90.0.4415.0 (master) (#27694)
* chore: bump chromium in DEPS to 520c02b46668fc608927e0fcd79b6a90885a48bf

* chore: bump chromium in DEPS to 90.0.4414.0

* resolve chromium conflicts

* resolve v8 conflicts

* fix node gn files

* 2673502: Remove RenderViewCreated use from ExtensionHost.

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

* 2676903: [mojo] Remove most legacy Binding classes.

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

* 2644847: Move self-deleting URLLoaderFactory base into //services/network.

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

* 2664006: Remove from mojo::DataPipe.

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

* 2674530: Remove CertVerifierService feature

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

* 2668748: Move OnSSLCertificateError to a new interface.

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

* 2672923: Remove RAPPOR reporting infrastructure.

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

* 2673502: Remove RenderViewCreated use from ExtensionHost.

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

* 2655126: Convert FrameHostMsg_ContextMenu and FrameMsg_ContextMenuClosed|CustomContextMenuAction to Mojo

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

* 2628705: Window Placement: Implement screen.isExtended and change event

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

* 2643161: Refactor storage::kFileSystem*Native*

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

* fix build

* only remove the biggest subdir of //ios

* chore: bump chromium in DEPS to 90.0.4415.0

* update patches

* update sysroots

* 2686147: Remove WebContentsObserver::RenderViewCreated().

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

* 2596429: Fixing how extension's split and spanning modes affect OriginAccessList.

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

* 2686026: [mojo] Delete AssociatedInterfacePtr (replaced by AssociatedRemote)

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

* 2651705: Move ui/base/dragdrop/file_info to ui/base/clipboard

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

* 358217: drawBitmap is deprecated

https://skia-review.googlesource.com/c/skia/+/358217

* fix gn check

* 2678098: Use gen/front_end as input to generate_devtools_grd

https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678098

* 2674530: Remove CertVerifierService feature

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

* fixup 2664006: Remove from mojo::DataPipe.

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

* fixup build_add_electron_tracing_category.patch

* 2673415: [base] Prepare CrashReporterClient for string16 switch

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

* 2673413: Add CursorFactoryWin to handle Cursors on Windows

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

* 2668748: Move OnSSLCertificateError to a new interface.

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

* fix mas gn check

* update patch after merge

* Update node for .mjs files

* build: load v8_prof_processor dependencies as ESM

* chore: add patch to fix linux 32bit

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-03-04 09:27:05 -08: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 d756a1b8cfeba5900c95863ca29cb15d9e1b15e4..3159df3456483453b9b362bb8942b45160d67b4d 100644
--- a/content/browser/notifications/blink_notification_service_impl.cc
+++ b/content/browser/notifications/blink_notification_service_impl.cc
@@ -87,9 +87,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),
@@ -150,8 +152,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 dcb0b03f0b814238860a17f88c1d7ed00546dad4..17184d672af88947c04b30de0aa62acda84084fb 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 8d516c814ef9882f15aaa903121a1c7a8270d28e..da523905809761a10cabb0963a691dd268d08f1c 100644
--- a/content/browser/notifications/platform_notification_context_impl.cc
+++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -284,12 +284,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 60558d5f40b765ed3ca2f7d1abc1b95f7518fee9..ab44370dc89f64fe2b86089fd9781b710fbcec8a 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 0f62a9f4e236e8e91e06dfb5751cde17dddb7233..df3ff59008839c786217661e8862ba54580590ed 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2179,7 +2179,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 2f5b8be21c8b37bb6a0c7fe52c87cb7f9debbca0..7934f6e625584466ff0aabc69583343c728759ea 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,