0
Commit Graph

20 Commits

Author SHA1 Message Date
Yao Xiao
94203f54e2 [shared storage] Provide BrowserInterfaceBroker to the worklet
Why:
This change will allow the reuse of existing components that already
utilize BrowserInterfaceBroker for Mojo connection setup. One
potential example is blink::LockManager for Web Locks API support,
which sets up a mojom::blink::LockManager connection. Regardless,
the BrowserInterfaceBroker provides a streamlined approach to
bootstrap Mojo service connections.

Note:
- 1. No behavior change -- I went through the caller sites for
  WorkletGlobalScope::GetBrowserInterfaceBroker() and identified
  ukm::mojom::UkmRecorderFactory as the only potential interface that
  can be requested within a SharedStorageWorklet. To maintain code
  simplicity, we avoid special-casing renderer logic and disable
  ukm::mojom::UkmRecorderFactory on the browser side.
- 2. Other usages appear to originate from non-(SharedStorage)Worklet
  contexts. If any usages were overlooked, this could lead to
  renderer crashes. We will actively monitor overall crash reports
  to promptly address any issues arising from this change.

Bug: 365578420
Change-Id: Ie0df93761f3194b6a90a4b7e7b867a43047a69b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5847692
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1355290}
2024-09-13 17:35:57 +00:00
Lukasz Anforowicz
5fd0efb315 Remove unused, unsafe AgentGroupSchedulerImpl::broker_ field.
This field is:

* Unsafe in presence of Oilpan (see https://crbug.com/40261265)
* Not actually used - there are no callers of
  `AgentGroupScheduler::GetBrowserInterfaceBroker`.  This method was
  added in https://crrev.com/c/2677585 and AFAICT no callers have ever
  been added later - for example this command finds no other commits:
  `git log -S AgentSched -- content/browser/browser_interface_binders.cc`

Removing this field also helps to make progress on
https://crbug.com/41482945 - this field is related to 1 out of 5 callers
of `BrowserInterfaceBrokerProxy::Bind` and the linked bug requires
passing `ContextLifecycleNotifier` to `HeapMojoRemote`.  I note that
`AgentGroupSchedulerImpl::BindInterfaceBroker` seems to be the only
caller of `BrowserInterfaceBrokerProxy::Bind` which doesn't have a 1:1
relationship with a `ContextLifecycleNotifier` (which IIUC roughly
corresponds to the `ExecutionContext`).  The other callers are 1)
constructor of `WorkerGlobalScope`, 2) constructor of
`content::RenderFrameImpl`, 3)
`MojoBindingContext::SetMojoJSInterfaceBroker` (we ignore here
`GetEmptyBrowserInterfaceBroker` which doesn't actually need to bind an
actual mojo remote).

Fixed: 40261265
Bug: 41482945
Change-Id: Id07826bb008bea6157a30868a56ad05ad3bbc675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5646657
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1319775}
2024-06-26 15:29:53 +00:00
Seung Jae Lim
c16c5e138a Create a pipeline from render frame host to VibrationManager
Design doc: go/crca-cspp-ping-vibration-api

Change-Id: I7b34c92559fcca9f650240b4b7afab3c76f9a7da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5490193
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Seung Jae Lim <andysjlim@chromium.org>
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1299589}
2024-05-10 23:30:00 +00:00
Alexis Menard
d99e01fcf7 [Device Posture] Move device posture implementation out of services/
It's becoming clear that the posture is not a global state. On Android
the posture is tied to an Activity : for example an Android Activity can
be on an external screen or two Chrome instances side by side and Android does not return the physical posture of the device. While right now Windows is a global state we can imagine scenarios like this where the "logical" posture doesn't match the physical posture.

This patch moves the device_posture mojo implementation out of services/. This means that now it is attached to a given web content. This allows us to simplify some of the implementation now that we can assume the receivers are from the same web content.

Also now that we are in the content/ layer we can directly hook into the device posture classes to implement the viewport segments support in RWHA.

Bug: 1517764
Change-Id: I173d6913d953134dc6f1973d511b5e874de38158
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5202826
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Alexis Menard <alexis.menard@intel.com>
Cr-Commit-Position: refs/heads/main@{#1253273}
2024-01-29 14:39:37 +00:00
Menard, Alexis
81d700e716 DevTools, Device Posture: Allow the device posture to be overridden by the DevTools
This patch extend the DevTools protocol to allow overriding the device posture.

It refactors the mojo implementation to make sure that only a single connection to the device service is made per window, allowing the device posture service to know which connection is emulated/overridden which will update the clients (JS bindings/MQs).

This patch also remove the device posture browsertests and make them web tests so the added codepath is tested.

Emulating the device posture should be available from every platforms therefore the patch enables the mojo bindings on platforms that do not have native support for device posture. This would be required anyway when the API will ship.

Bug: 1066842
Change-Id: I6184d39c78fb86dc4a906ae64afef0811598d661
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5067005
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Alexis Menard <alexis.menard@intel.com>
Cr-Commit-Position: refs/heads/main@{#1232398}
2023-12-02 17:38:41 +00:00
Avi Drissman
adac219925 Update header includes for /base/functional in /content
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: 1364441
Change-Id: I32ec425b9c0e52ec4b50047bf3290fecc5c905ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148554
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091567}
2023-01-11 23:46:39 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Alexis Menard
61ecb91dbc [Device Posture API] Implement posture service and connection to blink
Add a feature flag to experiment with the API.

Add skeleton backends for a Windows and Android implementation.

Bug: 1066842
Change-Id: I5724f73d3a65ecd371d7e99494789556b84621fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2985142
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Alexis Menard <alexis.menard@intel.com>
Cr-Commit-Position: refs/heads/master@{#902769}
2021-07-17 04:10:33 +00:00
Lei Zhang
0c429efa10 Remove unnecessary includes in BrowserInterfaceBinders.
BrowserInterfaceBinders is one of the biggest classes around. Reduce
excess includes to try to help reduce its size. Headers being removed
are based on suggestions from the IWYU tool.

Also combine some conditional includes into an #if/#else block.

Bug: 1227131
Change-Id: I9fbf9d7a7ced22ca0ccaa482d9aef75df1f4f480
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3035433
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902736}
2021-07-16 23:40:16 +00:00
Hans Wennborg
2141eeb826 Don't include service_worker_info.h in browser_interface_binders.h
It's not needed, and include graph analysis suggests this edge adds ca
450 MB of inputs to the 'chrome' build target on Linux.

Bug: 242216
Change-Id: I7fea13d0dd3face662967017fac8db13ad64cc2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2919815
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#887108}
2021-05-27 11:17:29 +00:00
Julie Jeongeun Kim
e58b0f4fe7 Add ContentBrowserClient support for service worker-scoped binders
This CL adds RegisterBrowserInterfaceBindersForServiceWorker() to
content::ContentBrowserClient to support a general method for
binding an interface scoped to service workers.
ContentBrowserClient::BindBadgeServiceReceiverFromServiceWorker()
is replaced with using it.

It introduces ServiceWorkerVersionBaseInfo as a minimal version of
ServiceWorkerVersionInfo to expose other folders than //content.

Bug: 1045214
Change-Id: I24b82875df79f1eaf89adc3d80bd52db9394ac33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2805764
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Chase Phillips <cmp@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Asami Doi <asamidoi@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#875024}
2021-04-22 05:33:28 +00:00
Tal Pressman
d12a68113f Implement per-AgentSchedulingGroup BrowserInterfaceBroker.
This CL introduces an AgentSchedulingGroup-bound BrowserInterfaceBroker
that may be used to bind interfaces that have Agent-level requirements
(most often, ordering guarantees). For now, the new BIB is accessible in
the renderer process via blink::AgentGroupScheduler.

The CL does not contain any uses of the new BIB, that will follow in
separate CLs for appropriate interfaces (e.g.: DomStorageProvider).

Design doc: https://docs.google.com/document/d/1VfHclmYENO2CYYEOK9wV-9xPIFOTQdXS4X56xHx_1PU/edit?usp=sharing

Discussion: https://groups.google.com/a/chromium.org/g/platform-architecture-dev/c/DVV_DihUdVw/m/TQ07otwRDwAJ
Change-Id: Ie169c2f0b0cc2dc1db2686ff271412ee01f51908
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2677585
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Tal Pressman <talp@google.com>
Cr-Commit-Position: refs/heads/master@{#853396}
2021-02-12 04:29:01 +00:00
Johann
165093e329 BatteryMonitor: Use Frame BrowserInterfaceBroker
Bind the battery monitor to the RenderFrameHostImpl BIB instead of the
RenderProcessHostImpl BIB. This allows freezing/managing the interface
with more granularity.

Remove multiple-windows tests. These were necessary when multiple
windows could share the same mojo connection. Since each page has its
own connection these tests are no longer necessary.

Bug: 1126758

Change-Id: Iba5a928105d19a9e86f9100fa6fdcf356b847c29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500968
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#828585}
2020-11-18 04:25:30 +00:00
Hiroki Nakagawa
593b6f5f28 ServiceWorker: Rename ServiceWorkerProviderHost to ServiceWorkerHost
ServiceWorkerProviderHost is equivalent to RenderFrameHostImpl,
DedicatedWorkerHost, and SharedWorkerHost. For name consistency, this CL
renames ServiceWorkerProviderHost to ServiceWorkerHost.

Design doc:
https://docs.google.com/document/d/1epWIgelE-7uwxJHrYPKlbwqMRP9in2xLUR6mpiU_afY/edit?usp=sharing

Bug: 931087
Change-Id: I583838006e8c10540acbe0a2681d11b8d9aad1ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203781
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771463}
2020-05-25 03:10:25 +00:00
Robert Sesek
5a5fbb8cf4 Merge service_manager::BinderMapWithContext into mojo::BinderMap
Tbr: oksamyt@chromium.org
Bug: 1046578
Change-Id: Ic2c01ee09c4b6a9fb2a936acf28fc0f00dc053f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2174654
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765090}
2020-05-04 16:18:28 +00:00
Ken Rockot
05499cf262 Migrate Device Service clients [1/n]
This moves DeviceService client code off of Service Manager APIs and
onto direct usage of the browser's global GetDeviceService() API.

This CL covers all clients of BatteryMonitor, PowerMonitor,
TimeZoneMonitor, ScreenOrientationListener, NFCProvider, and
VibrationManager.

Bug: 977637
Change-Id: I34727b14ff36ffff95724724ad6011d693f2d6cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1957184
Reviewed-by: Ryan Sturm <ryansturm@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724143}
2019-12-12 05:22:54 +00:00
Oksana Zhuravlova
fdfdd3080f Add Origin to ServiceWorkerVersionInfo
This change adds |script_origin| field to ServiceWorkerVersionInfo and
switches to this struct as context for service worker-scoped
BrowserInterfaceBroker handlers.

Bug: 993409
Change-Id: I250aee340c6ee85e8a2b8f5412eaeefbd52b0dbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779010
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693293}
2019-09-04 18:59:32 +00:00
Oksana Zhuravlova
d4bbeec02c [mojo] Add BrowserInterfaceBroker support for service workers
This change adds BrowserInterfaceBroker plumbing for service workers,
as well as support of task runners for binding interface handlers.
It also converts BackgroundFetchService clients in blink to use
BrowserInterfaceBroker as a use case.

Bug: 985110, 985112, 976962
Change-Id: I5c431f3f862cb3ac10d389f8c7afea3734d5bfd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742779
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#686578}
2019-08-13 21:43:57 +00:00
Oksana Zhuravlova
ceb2cef5ba [mojo] Add BrowserInterfaceBroker support for shared/dedicated workers
This change adds BrowserInterfaceBroker support for binders with context
(in this case shared and dedicated workers), as well as plumbing for
shared and dedicated workers.
It also converts FileSystemManager client in blink to use
BrowserInterfaceBroker for all contexts (should be safe because shared
workers don't use this interface).
DedicatedWorkerHost now has its own header since it is used by
browser_interface_binders.cc

Bug: 985112
Change-Id: If412b07948a0ae7831ec109ae876b0b62ffc1125
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1721936
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Flack <flackr@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685422}
2019-08-09 01:09:59 +00:00
Oksana Zhuravlova
fee097c076 [mojo] Introduce BrowserInterfaceBroker
This CL adds the mojom interface that the renderer will use to get
interfaces from the browser, as well as its implementation, functions
for registering interface handlers and all the necessary plumbing.

This CL also converts AudioContext to use BrowserInterfaceBroker.

Bug: 718652
Change-Id: I6b24bc802ca482feac1d8ae5fff7e5bf44215fa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688547
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681341}
2019-07-26 17:01:30 +00:00