0
Commit Graph

15504 Commits

Author SHA1 Message Date
f15f0b58c0 [Extensions] Clean up dependencies in extensions/browser/api. (1a)
This a reland of f3df55ae2d. It adds
an explicit public_dep to the automationInternal API that's needed
for a fuzzer test.

This is the first in a series of CLS to clean up the dependencies in
the various API implementations.

Bug: 40593486
Change-Id: I00bb1fdbab85778caa7eae228e048332610626c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090029
Commit-Queue: Emilia Paz <emiliapaz@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395196}
2024-12-11 17:18:30 -08:00
ad77162f7e Move extensions::Command to ui::Command
This is part of the effort to move GlobalShortcutListener to
//ui/base. We need the API for this class to reference general
concepts rather than extensions specific concepts. So this moves
the extensions concepts out into a subclass.

This will ultimately be replaced by more of a builder/utils pattern
but this is the first step that is needed to unblock the rest of the
migration.

Bug: 378487333
Change-Id: I15d3420eb8a2f1beb3bd89e5cb99f1f1f9f4f775
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081681
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Reviewed-by: Dana Fried <dfried@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395168}
2024-12-11 16:21:57 -08:00
8fbcfc4f88 Add comment to variations_state.bin feedback attachment
To clarify it is a binary file.

Fixed: 382742238
Change-Id: I33f5827adbc3b0f9f3eb37865e0d71dd2db5b8d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6089481
Commit-Queue: Xiangdong Kong <xiangdongkong@google.com>
Reviewed-by: Xiangdong Kong <xiangdongkong@google.com>
Auto-Submit: Sven Zheng <svenzheng@chromium.org>
Commit-Queue: Sven Zheng <svenzheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395164}
2024-12-11 16:15:35 -08:00
3cb0b1bccf [Extensions] Untrack service worker state when stopping and stopped.
The extension system could incorrectly assume a service worker was
still running even though it was stopping or had stopped. This could
lead to webRequest events being dispatched to inactive listeners,
potentially causing events to be sent but never received by the worker.

This change ensures that active listeners associated with a stopping or
stopped service worker are removed immediately. This prevents events
from being sent to these inactive listeners.

Additionally, the service worker is now untracked from the
ProcessManager when it's in the stopping state, similar to how it's
handled in the stopped state.

This also additionally untracks both the browser and renderer state
during stopping and stopped synchronous browser notifications.

Bug: 331358156
Change-Id: I18c055c697a0b7897d917d0084f2f340962d6ac7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6071609
Commit-Queue: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395117}
2024-12-11 14:38:19 -08:00
9e4a429c01 [Extensions] Clean up more install-related prefs.
This CL moves more install-related prefs out of the ExtensionPrefs
class and into helper functions. There are temporary calls into the
helper functions from ExtensionPrefs, but these will be removed as
more code is moved out into helper functions.

Bug: 40593486
Change-Id: Ib3daa21944d5ed10fa43e30a20a77570d880871d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6068208
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Anunoy Ghosh <anunoy@chromium.org>
Reviewed-by: Tim Sergeant <tsergeant@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: Tony Yeoman <tby@chromium.org>
Reviewed-by: Tim <tjudkins@chromium.org>
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394986}
2024-12-11 11:08:51 -08:00
543e49a7a7 Revert "[Extensions] Clean up dependencies in extensions/browser/api. (1)"
This reverts commit f3df55ae2d.

Reason for revert: breaks libfuzzer asan builder on chrome os
https://ci.chromium.org/ui/p/chromium/builders/ci/Libfuzzer%20Upload%20Chrome%20OS%20ASan/118209/overview

Original change's description:
> [Extensions] Clean up dependencies in extensions/browser/api. (1)
>
> This is the first in a series of CLS to clean up the dependencies in
> the various API implementations.
>
> Bug: 40593486
> Change-Id: I617f8b742d047c70672d526222f3063cd294d60d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081900
> Auto-Submit: David Bertoni <dbertoni@chromium.org>
> Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
> Commit-Queue: David Bertoni <dbertoni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1394580}

Bug: 40593486
Change-Id: Id7606f98aad58a270b18c622a337695cf8d0b9e0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6089453
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: William Liu <liuwilliam@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394886}
2024-12-11 08:58:05 -08:00
a79e6199f3 Clean up feature flag for enabling BFCache with extension message
The feature has been landed for around a half year, this CL cleans up
the feature check and tests.

Bug: 40283601
Change-Id: I2009a846f3ab2e910150cd53a8fad7580f3aab62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6083651
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Mingyu Lei <leimy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394692}
2024-12-11 07:14:15 +00:00
59bf9d30d5 [Extensions] Add a BUILD.gn file for the clipboard API.
Bug: 40593486
Change-Id: I39fdefc8edd4cee5fb28dc5b9400cea1f95fcdb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6086897
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Tim <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394653}
2024-12-11 03:03:48 +00:00
f3df55ae2d [Extensions] Clean up dependencies in extensions/browser/api. (1)
This is the first in a series of CLS to clean up the dependencies in
the various API implementations.

Bug: 40593486
Change-Id: I617f8b742d047c70672d526222f3063cd294d60d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081900
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394580}
2024-12-11 00:02:50 +00:00
b651d89974 [Extensions] More Ash/Lacros cleanup.
b: 354842935
Low-Coverage-Reason: TRIVIAL_CHANGE This CL adds no new code.
Change-Id: I42bab6e9b89728508b9d7c4ec0bfab4e20e995fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6052802
Reviewed-by: Kelvin Jiang <kelvinjiang@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394557}
2024-12-10 23:16:09 +00:00
e8245aeb77 [Extensions] HidDeviceManager DependsOn(EventRouter).
Before this change HidDeviceManager held onto a raw_ptr<EventRouter>
even after context keyed service (EventRouter) could be destroyed.

After this the HidDeviceManager now depends on EventRouter so it will
be destroyed before EventRouter in the future.

This fixes a crash in a downstream CL where we change the dependencies
of EventRouter which causes it to destruct earlier.

Bug: 331358156
Change-Id: I3dcecdab12661037fdc918b8508b2c8a8d20351b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6085811
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: Justin Lulejian <jlulejian@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394546}
2024-12-10 22:58:44 +00:00
d15fd76ecb Change RenderProcessHost::GetID to RenderProcessHost::GetDeprecatedID
This change bulk changes RenderProcessHost::GetID to
RenderProcessHost::GetDeprecatedID to support the transition to a
strongly typed ChildProcessId.

Bug: 379869738
Change-Id: Ib0c991536486ef29702ea166cdcf12ea68ed70ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065543
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Emily Andrews <emiled@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1394500}
2024-12-10 20:41:54 +00:00
126d72b1cd [Extensions] Cover more open channel failure metric cases.
Before this change we covered some of the early bail-outs when
attempting to open a channel to an extension, but there are five that
were not. If these cases were hit the metric would be emitted as "hung"
which isn't accurate.

After this we emit for every known control flow of opening a channel to
an extension so any future "hung" metrics are truly because the attempt
hung during one of the stages of opening a channel.

Bug: 371011217
Change-Id: I12eeb62900ef392c0ffc40ac1feb9375c8f95a48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6085803
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: Justin Lulejian <jlulejian@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394465}
2024-12-10 19:45:48 +00:00
98a4e3d98c for webui's with webviews, change media permissions
media permission requests in webviews must be approved
by the embedder. Approved requests are currently forwarded
without modification -- they will appear to come from the
embedded origin. This CL changes this behavior for chrome:
origins that embed webviews: the forwarded permission
request will appear as coming from the chrome: origin.

Note that media permission differs from location permission,
which is already forwarded as coming from the embedder origin.
This CL does not change behavior on chrome-extension embedders,
so is unlikely to materially affect any existing code or features.

This change is to support chrome://glic

Bug: 377975471
Change-Id: Ia67d4a6435ce61b46579709052af39760691c018
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6072787
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394350}
2024-12-10 16:53:12 +00:00
88c1360ad0 ash: Remove obsolete standalone_browser::GetFeatureRefs
The remaining uses of the function are for disabling Lacros, which has
become a no-op.

Bug: b:365741912
Change-Id: I62dbd57839749246da0aa0e1f47708eb07ee4031
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6079775
Commit-Queue: Georg Neis <neis@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394025}
2024-12-10 01:29:30 +00:00
d5941a9e5f Include variations in feedback
Include Chrome commandline variations in feedback report so developers
can repro experiment related issues for debugging.

When user create a feadback report and the "Include system information"
checkbox is checked, we will include Chrome commandline variations in
the report. The data is encrypted. Only authorized developers can
decrypt the report for repro purpose.

Only affects Chrome on Windows, Linux, Mac.

The public key was created with cl/700793735. Please see the cl for
the details about how I created the key and testing.

Design doc: go/finch-listnr-design

successfully with the tool in cl/700793735.

Test: Tested on Linux. Created a feedback report and decrypted
Bug: 373470046
Change-Id: Ib252818bf257cce7fed7c3ef4ca449599b590887
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6001442
Reviewed-by: Elly FJ <ellyjones@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Sven Zheng <svenzheng@chromium.org>
Reviewed-by: Xiangdong Kong <xiangdongkong@google.com>
Cr-Commit-Position: refs/heads/main@{#1393801}
2024-12-09 19:23:26 +00:00
5aed13da88 [Desktop Android CRX] Add support for incognito split mode.
This change adds support for incognito split mode in the Android extension.

In this mode, each profile (regular and incognito) have its own extension system, but they need to share some underlying services to work correctly. The desktop implementation achieves this using a
`shared_` instance (a profile keyed service under //chrome/browser),
see:
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/extensions/extension_system_impl.h;drc=5108636c70c0b08fdbeb57de2640a22e138f6685;bpv=1;bpt=1;l=91

However, DesktopAndroidExtensionSystem currently doesn't have this functionality. Each instance of DAExtensionSystem has its own instances
of the underlying services, which are initialized for regular profile
by InitForRegularProfile(), but never initialized for incognito profile.

As a result, when an extension running with incognito profile in split
mode tries to execute a extension function which uses a service (like
the quota service), it crashes because the service hasn't been initialized. For example,
OffscreenApitest.IncognitoModeHandling_SplitMode crashed at:
https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/extension_function_dispatcher.cc;l=375?q=ExtensionFunctionDispatcher::DispatchWithCallbackInternal&ss=chromium%2Fchromium%2Fsrc

This cl fixes the crash by explicitly calling InitForRegularProfile()
to initialize the services from the test, even though it's not the ideal solution.

The correct approach is to implement a shared instance mechanism for ExtensionSystem on Android, like the desktop implementation.

This cl also ports 2 api tests for incognito profile in split
mode.


Bug: 356905053, 378916068, 371263572
Change-Id: I0c64db2261c8680171ab6c005146670de2f22b90
Cq-Include-Trybots: luci.chromium.try:android-desktop-14-x64-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6068688
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Jenny Zhang <jennyz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1393050}
2024-12-06 19:06:46 +00:00
1d0ed127c6 system_display: Use ChromeOS instead of Chrome OS
Change-Id: I020d49d49ba49f80bbfc83e251215f92cd5facc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6068377
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1393035}
2024-12-06 18:48:04 +00:00
466ff27c06 [DNR] Fix crash when "rule" is not specified as a dict
When parsing JSON ruleset files, we assume that each rule would be
specified as a dictionary if we couldn't parse it into a dnr_api::Rule

Unfortunately this is not the case, which causes the crash when
attempting to access rules_list[i[.GetDict() which CHECKs that
rules_list[i] is in fact a dict (and crashes if it's not)...

Somewhat simple fix: fall back to the index for reporting parse error
if the rule is not a dict.

Bug: 378335062
Change-Id: I196e33f236fe5ad6607f6e5e1b2b8d62a3a233cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6074925
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: Kelvin Jiang <kelvinjiang@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392680}
2024-12-06 01:36:57 +00:00
aefef9b522 [Boca] Allow boca app to use webview
This will allow the app to embed a page for viewing student screens.
This will be implemented in our app's UI code in G3.

Bug: 382275809
Change-Id: I343765599c8822d69294f3daec5117e3b4205855
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6071089
Commit-Queue: Benjamin Zielinski <bzielinski@google.com>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391873}
2024-12-04 22:06:25 +00:00
744f465da9 [Extensions] Emit metric for DispatchOnConnect IPC for frames/workers.
New Metric:
  Extensions.MessagePipeline.OpenChannelWorkerDispatchStatus{DispatchTarget}{ChannelType}

This metric tracks the result of each time the DispatchOnConnect IPC is
sent to a frame or a worker. It tracks whether the message was:
  * received by the browser (acked)
  * channel/port disconnect occurred before the message was acked
  * or none of the above (hung)

Bug: 371011217
Change-Id: I35ef71c9e176feae1c8e1d4856bcec2932f1d94a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065439
Commit-Queue: Justin Lulejian <jlulejian@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391446}
2024-12-04 04:15:35 +00:00
fb46d5333e controlledframe: Fix crash when logging loadabort event
Bug: 381936157
Change-Id: Ifefc504a61cf36fdc80cf849f50c562a2bfa28b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065345
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391139}
2024-12-03 18:59:24 +00:00
fab2bec133 Clean up stale base::Feature "AllowSharedArrayBuffersUnconditionally"
It looks like the goal at one point was to disable this in M95, but that
has long come and passed. The tracking task for it was closed too, so I
think this can be removed.

Fixed: 356624393, 40752831
Change-Id: I6abb5ab24ec4216698252c837891327eedcb5720
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6052091
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391129}
2024-12-03 18:42:16 +00:00
dba931722e Reland "[MPArch guest view] Fix loading extension resources inside a guest view"
This is a reland of commit cd4c24d550

Patch set 1 is as landed. Patch set 2 fixes Android desktop build.

Original change's description:
> [MPArch guest view] Fix loading extension resources inside a guest view
>
> - Ensure that the view type is correct for guest views, this previously
> was computed from the WebContents but we should use the RenderFrameHost
> for this.
> - Provide an API to get the owner RenderFrameHost before attachment.
>
> Bug: 40202416
> Change-Id: I351313f06cd7a221e9c9bae0e3c155e827b3be51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6053978
> Reviewed-by: Greg Thompson <grt@chromium.org>
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: David Bertoni <dbertoni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1390990}

Bug: 40202416
Change-Id: I60c6cb3b2f7929e280a27d456b4ab1deef44b3ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064556
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391117}
2024-12-03 18:26:13 +00:00
9ba9c705f6 [Extensions] Remove ServiceWorkerTaskQueue friend class of WorkerState.
WorkerState nearly has all the methods to no longer be a friend class
so let's refactor it to remove it.

Bug: 40936639
Change-Id: I3f939d087c85f214cf15cebba0268757742676c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065964
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391102}
2024-12-03 18:12:11 +00:00
42fd056490 Revert "[MPArch guest view] Fix loading extension resources inside a guest view"
This reverts commit cd4c24d550.

Reason for revert: Suspected CL for tree closure, see https://ci.chromium.org/ui/p/chromium/builders/ci/android-desktop-x64-compile-rel/8621/overview

Original change's description:
> [MPArch guest view] Fix loading extension resources inside a guest view
>
> - Ensure that the view type is correct for guest views, this previously
> was computed from the WebContents but we should use the RenderFrameHost
> for this.
> - Provide an API to get the owner RenderFrameHost before attachment.
>
> Bug: 40202416
> Change-Id: I351313f06cd7a221e9c9bae0e3c155e827b3be51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6053978
> Reviewed-by: Greg Thompson <grt@chromium.org>
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: David Bertoni <dbertoni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1390990}

Bug: 40202416
Change-Id: Icb72c3bf3bac86d9d4e2f3d2e00df8740859326c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6063491
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Florian Jacky <fjacky@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Florian Jacky <fjacky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390999}
2024-12-03 15:23:47 +00:00
cd4c24d550 [MPArch guest view] Fix loading extension resources inside a guest view
- Ensure that the view type is correct for guest views, this previously
was computed from the WebContents but we should use the RenderFrameHost
for this.
- Provide an API to get the owner RenderFrameHost before attachment.

Bug: 40202416
Change-Id: I351313f06cd7a221e9c9bae0e3c155e827b3be51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6053978
Reviewed-by: Greg Thompson <grt@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390990}
2024-12-03 15:02:16 +00:00
e8f2ed848f extensions: Add chrome.system.cpu API to the desktop android build
This CL just adds the API implementation to the build. A later CL will
add the //chrome level API test.

Bug: 381925994
Test: chrome_apk run, android_browsertests --gtest_filter=DesktopAndroid*
Change-Id: I04ab3cd9808e9ccd0cd7231f2c98c42a529c545d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064924
Commit-Queue: James Cook <jamescook@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390732}
2024-12-03 01:22:02 +00:00
1f897a50ca [Extensions] Refactor ReportOpenChannelResult as a class method.
This allows us to condense some logic by using the class members inside
the method.

Bug: 371011217
Change-Id: Ie9f2ac0a26332da0d2a66078004077c7ce40893d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064221
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390481}
2024-12-02 18:52:18 +00:00
b2856d02ed Convert kWebstoreSignaturesPublicKey to span
Convert the array to span and update call sites.

Bug: 40285824
Change-Id: Ia457b966919727e98cc4e3e2972f20149013c68b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6061641
Reviewed-by: Oleg Davydov <burunduk@chromium.org>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Janusz Majnert <jmajnert@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1390358}
2024-12-02 16:22:28 +00:00
f61d3bb7c9 Remove usage of base::make_span(): extensions/
Replace with span() CTAD use, or more targeted helpers.

Bug: 341907909
Change-Id: Ie4def5694939b1b07c4673488a2f3e96d300dbf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6058608
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389800}
2024-11-29 15:04:30 +00:00
7b1ecd8690 Make CHECK() failures understood as [[noreturn]]
This works around a few macros that sometimes-CHECK() since we can't
generate dead-code warnings in some builds but not others.

CHECK_LT(1, 1) still isn't understood as [[noreturn]] when
CHECK_WILL_STREAM() in the current implementation. A TODO is left to
address that, but whether that's practically useful/beneficial.

Bug: 40122554
Cq-Include-Trybots: luci.chromium.try:linux-asan-rel
Validate-Test-Flakiness: skip
Change-Id: If3b074982b65abb9e7f8ccc46ffb030285e0b7b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6043197
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389181}
2024-11-28 02:50:40 +00:00
8cc7e13927 controlledframe: Add ControlledFrame use counter
This adds a ControlledFrameElement use counter that will be recorded
every time a new Controlled Frame is created.

Bug: 379887022
Change-Id: Icfc4eb43e3972ceb14bd453390c4ee4609e75c19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6033035
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Chase Phillips <cmp@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388984}
2024-11-27 19:16:03 +00:00
8163169db7 [Omnibox API] Adding a new omnibox permission
The new permission asks for always using keyboard input outside keyword
mode. The permission is behind a feature flag that is disabled by
default.

Screenshot of permission shown in the extension manager:
https://screenshot.googleplex.com/32PuzgJFv8ig2qb

Screenshot of the error shown when the feature is not enabled
but the extension manifest has the permission:
https://screenshot.googleplex.com/8542PzUPfesCp76

Bug: 379144969
Change-Id: I7bacc22044421d849375b7f85b22b035a44d5a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6023517
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Kelvin Jiang <kelvinjiang@chromium.org>
Commit-Queue: Salma Elmahallawy <esalma@google.com>
Cr-Commit-Position: refs/heads/main@{#1388832}
2024-11-27 15:23:51 +00:00
2d83e83347 Reland "[Extensions] Nullify ProcessManager::site_instance_"
This relands commit 0e35ed6882.

This was reverted because of an issue where a MimeHandlerViewGuest
had a RenderFrameHost swap, which meant that handles in the test
were invalidated, leading to UAFs (in the test only). However, since
other code may be relying on the same type of behavior, fix this by
going back to using a direct SiteInstance in the MimeHandlerViewGuest.

----- Original CL Description -----
This CL is based off nasko@'s CL at
https://chromium-review.googlesource.com/c/chromium/src/+/5142350.

For various historical reasons, there's a "primordial" shared
SiteInstance used for most extension hosts that's owned by the
ProcessManager. This should no longer be necessary, and has some
potentially undesirable side effects.

This CL sets that SiteInstance to null if the corresponding
feature kRemoveCoreSiteInstance is enabled. This is effectively the
same as removing the member, since the SiteInstance is now only used
in the creation of ExtensionHosts' WebContents, which can accept a
null SiteInstance (the same as passing no SiteInstance).

This requires adjusting a number of callsites, primarily those around
ExtensionHost creation, in order to provide them with a BrowserContxt
member directly. In the future, once we're sure this change is safe,
we will remove the SiteInstance member from ProcessManager entirely.

In addition to plumbing, this required:
- Changing where we set a temporary zoom level for extension popups
  to be immediately before we're ready to commit, rather than in the
  constructor; this is necessary since the primary RenderFrameHost
  will be swapped between these points.
- Updating how a few tests wait for readiness (to use more correct
  methods, rather than relying on racy conditions)
- Updating IsExtensionIdle() to look for a process entry in the
  ProcessMap instead of checking the SiteInstance from the
  ProcessManager.

Bug: 334991035 
Change-Id: Ib682f8dee02985bbef32be83e17fe3d42323d257
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6041245
Reviewed-by: Andy Phan <andyphan@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388577}
2024-11-27 01:30:46 +00:00
b62b2de9f6 [Extensions] Emit metrics for opening a channel for extension messages.
Metrics:
  Extensions.MessagePipeline.OpenChannelStatus{WorkerStatus}{ChannelType}
  Extensions.MessagePipeline.OpenChannelWorkerDispatchStatus{ChannelType}
  Extensions.MessagePipeline.OpenChannelWorkerWakeUpStatus{ChannelType}

This tracks several stages of the initial open channel portion of
sending an extension message.

It tracks each stage of this process as a separate metric. It emits a
relevant value from MessageTracker::OpenChannelMessagePipelineResult
that indicates where the process finishes (or fails).

It also make some minor changes to ServiceWorkerTaskQueue to make it
easier to emit a metric that is worker-based extension specific.

After this change we will be able to determine where in the open channel
process we might be experiencing issues which could contribute to
messages to worker failures.

Low-Coverage-Reason: OTHER message_port.cc DispatchOnConnect non-pure virtual method is empty.
Bug: 371011217
Change-Id: I4ae6628018a4d3d1c2e367244bf787f7db1b326c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5938256
Auto-Submit: Justin Lulejian <jlulejian@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388520}
2024-11-26 23:18:31 +00:00
e6beab2ee8 [Extensions] Delete unused method in WorkerThreadIPCMessageSender.
This method was implemented in crrev.com/c/1441274 (2019), but is not
used anywhere and would require modification in a downstream CL so
let's remove it.

Bug: 371011217
Change-Id: I81e7fb6a01c7f9dbc2d694e4d21b8aec01971f20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6051222
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388515}
2024-11-26 23:10:26 +00:00
4937ad9ae6 Use StrictNumeric<size_t> for more span methods.
Changes subspan(), split_at(), at(), and get_at() to match pre-existing
usage in constructors, first(), last(), etc.

Bug: 364987728
Low-Coverage-Reason: LARGE_SCALE_REFACTOR not significantly changing existing functionality
Change-Id: Ic7a33ebbfd7f70d4eed961fa78435d26bfac4bbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6044946
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388513}
2024-11-26 22:58:16 +00:00
43fcd0afbe [Extensions Cleanup] Remove EventPageTracker
This class was only ever implemented by ProcessManager, and had two
methods WakeEventPage() and IsEventPageSuspended().

IsEventPageSuspended() was only used in a single test file, and just
checks that there is no background host for an extension. This can be
trivially done by checking GetBackgroundHostForExtension() (which is
what the implementation did).

WakeEventPage() is called by numerous sites, but all of them do so by
accessing the ProcessManager. No sites accept or use the class as the
EventPageTracker, so having a separate class that the ProcessManager
inherits from is unnecessary.

Bug: None
Change-Id: Ie83d9b5eb83dcb458a29ab51a46ea33797203af4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6044582
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387960}
2024-11-26 00:58:25 +00:00
777b384b25 Cleanups from stricter span usage of size_t, pt. 2: extensions
More use of first(), compile-time sizes, size_t, etc.

Bug: none
Change-Id: I6b156f29aa01a4253f3e2824c731f1daf3c7fd1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6045614
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387948}
2024-11-26 00:43:31 +00:00
e1fc5c83ba [Extensions] add/removeSiteAccessRequest -> add/removeHostAccessRequest
Per conversations in the WECG [1], it's agreed that we should rename
permissions.addSiteAccessRequest and permissions.removeSiteAccessRequest
to permissions.addHostAccessRequest and
permissions.removeHostAccessRequest, since the "host" term is more
commonly used in other APIs and extension surfaces (such as
"host_permissions" in the manifest).

This CL renames the API function and corresponding C++ classes and
methods. Since the API was only released in M133 (which is still
pre-stable), this shouldn't be a breaking change for any published
extensions.

[1] https://github.com/w3c/webextensions/pull/529#issuecomment-2492042845

Fixed: 380291902
Change-Id: I38f118caba94526336ddbbfe89bea34ce42fd500
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039497
Reviewed-by: Oliver Dunk <oliverdunk@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Kelvin Jiang <kelvinjiang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387925}
2024-11-26 00:12:19 +00:00
c7fcc606d2 [MPArch guest view] Enable termination notification
Plumb termination of the guest's main frame via the GuestPageHolder.

Bug: 40202416
Change-Id: Iaf1ce0f8494f2103af1946158ea6cfb4b8f8f19f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6049297
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387881}
2024-11-25 22:46:29 +00:00
5f966bb7a3 [MPArch guest view] Enable load progress events for guest view
Plumb the load progress events to the GuestPageHolder.

Bug: 40202416
Change-Id: I3c93b47aa4bfee5136e96c9bf5d6825650531ec7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6044347
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387877}
2024-11-25 22:39:48 +00:00
717afe2da3 [DNR] Update checksum after reindexing on checksum mismatch
Currently DNR treats the checksum in prefs as the source of truth.
If a checksum for a ruleset is in prefs, then whenever that ruleset gets
enabled or re-indexed (except in the case of a version mismatch), then
the ruleset fails to load if the checksum from prefs does not match
the checksum obtained from re-indexing.

However, if prefs are corrupted or updated to a bad value as a result
of some kind of race condition, then that ruleset will never load.

Instead, we should treat the ruleset JSON files in the extension
package as the source of truth, so if a checksum mismatch occurs,
simply re-index the ruleset and update the checksum.

Adding content verification to guard against corruption/unwanted edits
to those ruleset files will be done in a follow up.

Bug: 380434972
Change-Id: I7aabb269c7ecb6935b328e07dbb8fdca5c563287
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6043767
Commit-Queue: Kelvin Jiang <kelvinjiang@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387868}
2024-11-25 22:31:29 +00:00
0a79be8c3c [Extensions Cleanup] Simplify ProcessManager construction
This CL cleans up ProcessManager construction in a few ways:
* Removes CreateForTesting(). This just called the (public) ctor, and so
  was unnecessary.
* Removes CreateIncognitoFortesting(). This was never used.
* Removes the `original_context` parameter passed to
  ProcessManager's ctor. This was only used to DCHECK that it was the
  same context as the one used on the ExtensionRegistry since the
  ExtensionRegistry is a shared service across on- and off-the-record
  contexts, which isn't really the purview of the ProcessManager to
  verify.
* Moves the Create() method used by the ProcessManagerFactory to be
  public. Since the ctor is public, there's no reason to have the
  Create() method be protected and require a friend class of the
  factory.

Bug: None
Change-Id: I14203330517de486d066cd5a912c4ccc9ca50665
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6044293
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387768}
2024-11-25 20:24:12 +00:00
26a1e6dfc3 [MPArch guest view] Fix up user agent metadata
The wrong override was being loaded for MPArch guest views.

Bug: 376085326
Change-Id: Ia33be753ffa0b7057fc7dd7df6da64be011e09bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6049999
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387763}
2024-11-25 20:16:14 +00:00
2fb03cbcbc Migrate Command::IsMediaKey to be a member of ui::Accelerator
I'm in the process of refactoring some of the global shortcut listener
to live outside of //chrome/browser/extensions so this will make that
process easier

This CL is pure refactoring and has no behavior change

Bug: 378487333
Change-Id: I28ca7979b146faa90d81b7ab76021857b315c1e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039836
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1387738}
2024-11-25 19:00:40 +00:00
7f4d721b03 [MPArch guest view] Enable sending the load event
Listen to the load event complete in the embedded main frame and forward
it to the guest holder.

Bug: 40202416
Change-Id: I623761dc68251eaa291e9e8dc62491cb34609e13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039024
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387726}
2024-11-25 18:29:15 +00:00
bc782f1740 [Extensions] Allow extensions to update script worlds to default world
Extensions can inject in multiple user script worlds, which are
specified by different user script world (string) IDs. If an ID isn't
specified, the extension injects in the default user script world ID.
However, this creates an issue with trying to update a registered
script to inject in the default world after initially registered with
a non-default world:
* Specifying any non-null value indicates a non-default world
* Specifying a null value will be dropped by the extension bindings

To enable this, allow extensions to use the empty string ('') as an
indicator that a script should use the default world. The API layer
converts the empty string to nullopt for use elsewhere in the
extensions system.

Bug: 331680187
Change-Id: I4b0ef064884dc5fac814c0680134c278d0b28fcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6036255
Reviewed-by: Kelvin Jiang <kelvinjiang@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387164}
2024-11-23 00:20:43 +00:00
40597e4e2c [Extensions Metrics] Remove unowned, unmapped histogram
Extensions.UpdateCheckUrlLength is emitted, but has no entries in
histograms.xml, thus being unowned and unmapped. Remove it.

Fixed: 40483376
Change-Id: I147cb0e0eecacfaf0e68b8ccbfde7b9cfb544758
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039838
Auto-Submit: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387139}
2024-11-22 23:46:12 +00:00