0
Commit Graph

121 Commits

Author SHA1 Message Date
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer

As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.

Script:
```
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "^content" \
    | sort \
    | uniq \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
      -e "\.py" \
    | xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
shaochenguang
3a1af3d254 Fix header guards in content/.
Generated mechanically as follows:

git ls-files '*.h' | grep -E '^content/' | \
    xargs parallel cpplint.py --filter=-,+build/header_guard -- 2>&1 | \
    grep build/header_guard | tools/apply_cpplint_header_guard.py

Bug: 1200694
Change-Id: I5518d2dbc6184f920d2b145c4c8209ae05090ecb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5052212
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1229527}
2023-11-27 21:36:51 +00:00
Avi Drissman
e0eb4161ea Remove uses of implicit conversion of ScopedTypeRef in /content
Implicit unwrapping of a scoper to its underlying pointer is dangerous
and that capability is being removed. This converts uses of implicit
conversion to be explicit in preparation for its removal, and performs
other cleanup and modernization.

Bug: 1495439
Low-Coverage-Reason: LARGE_SCALE_REFACTOR Switching from implicit to explicit
Change-Id: I455cff8584d3842ed51384aa21be1a5e2d032590
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4980069
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216299}
2023-10-27 19:15:50 +00:00
Julie Jeongeun Kim
852454c2e2 [ios] Add FontEnumerationDataSource
This CL includes FontEnumerationDataSourceMac in iOS to support
`Local Font Access API`.

Bug: 1487133
Change-Id: Ib420038ad3ff8cad3cd6a495b55a38d9bb440696
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4896697
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Julie Jeongeun Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1202279}
2023-09-28 04:08:22 +00:00
Andy Paicu
0a6d4b5069 [PEPC] Add new structs to contain permission request data
This CL adds new struct PermissionRequestDescription and
PermissionRequestData that groups all information we will need to make
a permission request to permission infrastructure.
This is one in a series of CLs implementing the design:
https://docs.google.com/document/d/1a1gjlJ4VkAWoG8AeGKZDcQXm_c0q-cFTs_5MxmjWVYI/edit, next step is to parse the fields within the structs handle permission request from <permission> element properly.

Bug: 1271543,1462930
Change-Id: I4a7b64149bc3323075f802f832766aa2211455fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4756727
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Kamila Hasanbega <hkamila@chromium.org>
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1189522}
2023-08-29 15:13:09 +00:00
Avi Drissman
28154a6fbb Move ScopedTypeRef and ScopedCFTypeRef into base:🍎:
This moves these two types into the base:🍎: namespace.

This also rolls Crashpad:

Update Crashpad to a736f7d070c872a4cc786c31755fd769fb2e50b3

50ce1550a1ca [fuchsia] Move //zircon/public/lib/zx to
             //zircon/system/ulib/zx
a736f7d070c8 Roll mini_chromium putting /base/apple files into
             base:🍎:

Fixed: 1474628
Change-Id: I3d529e6b6f4a6e48bc9edc2df830f9c2418ca678
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4799213
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1186262}
2023-08-22 04:06:45 +00:00
Avi Drissman
eac566b060 Move foundation_util to base/apple, leave a forwarding header
Crashpad is not yet updated for the new location, so leave a
forwarding header to be removed later.

Skipping trybots. This is a Mac change, and it’s passing all
trybots except for android_optional_gpu_tests_rel that is
repeatedly failing on an unrelated issue.

NOTRY=true

Bug: 1444927
Cq-Include-Trybots: luci.chrome.try:mac-chrome
Change-Id: Iad0c903187b0e1e5584c68f2eb00b5b026085596
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4790744
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1185029}
2023-08-18 02:56:21 +00:00
Avi Drissman
a09d7dda2e Move scoped_cftypreref to base/apple, leave a forwarding header
Crashpad is not yet updated for the new location, so leave a
forwarding header to be removed later.

Bug: 1444927
Change-Id: Ib00aa68980726f7702f740d543953abe397ffddc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4790741
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1184758}
2023-08-17 16:26:58 +00:00
Avi Drissman
9bf75c5e9a Remove ARC boilerplate in /content
ARC is now enabled by default, so there’s no need to enforce it
against files being put into non-ARC targets.

Bug: 1468376
Change-Id: If25307bfbea5a1df8937b433dde5fa83871cff74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4738888
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1178112}
2023-08-01 22:39:26 +00:00
Avi Drissman
d6b97c1b31 Convert /content/browser to use ARC
See https://chromium.googlesource.com/chromium/src/+/main/docs/mac/arc.md
for information about this conversion.

Bug: 1280317
Change-Id: I9e8fb0c2f74c55acef207ebdb866752e059af60c
Include-Ci-Only-Tests: true
Cq-Include-Trybots: luci.chromium.try:ios-blink-dbg-fyi
Cq-Include-Trybots: luci.chrome.try:mac-chrome
Validate-Test-Flakiness: skip
Low-Coverage-Reason: Doing core refactoring across all of Chromium; I do not own this code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4658680
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1166661}
2023-07-06 18:02:40 +00:00
hisbilir
d49444e064 Skip local fonts with invalid attributes during font enumeration on Mac.
It seems Mac OS allows installing fonts with invalid attributes although
the font verification during install detects it. Updated the local font
access code on Mac to skip such fonts during enumeration when Chrome
receives null for the attributes from Mac OS.

Bug: 1422669
Change-Id: Idbf164ccfb2306de2705b5f8eca4a68efb312d30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4596377
Commit-Queue: Hakan Isbiliroglu <hisbilir@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1159032}
2023-06-16 20:33:29 +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
Sean Maher
e672a665ff task posting v3: remove includes of runner handles and IWYU task runners
Turns out there's a lot of includes, so these will have to be removed
before deleting the implementation of the task runner handles.

To allow the deletion of the task runner handle headers, add
the sequenced/thread task runner handles where they are used in
the codebase with scripts.

This was done with an automated change, with a few touchups afterwards.
The code for the mass-refactor changes are here:
python:
https://paste.googleplex.com/5534570878337024
shell:
https://paste.googleplex.com/6466750748033024

In terms of touchups:
- add sequenced/thread task runner handles to
  the third_party/blink/public/DEPS, because multiple files were using
  it transitively anyways.
- rewrite certain parts of the codebase which used
  ThreadTaskRunnerHandles instead of CurrentDefaultHandles.
- fix a compile issue with forward-declaration in
  extensions/browser/extension_file_task_runner.h.

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I737ef32aee4e77c21eaa3a2bdc403a28322cf1b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133323
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Sean Maher <spvw@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1090532}
2023-01-09 21:42:28 +00:00
Keith Lee
d41880c794 Remove ability to append strings to NOTIMPLEMENTED_LOG_ONCE
This is a pattern that does nothing. It's used in many places, but the
string is just eaten by EAT_CHECK_PARAMS and is never logged.

However, many devs seem to assume this logs the message passed to it.
This pattern continues to be used as recently as
https://crrev.com/c/2575001 and can be easily found here:
https://source.chromium.org/search?q=NOTIMPLEMENTED_LOG_ONCE%5C(%5C)%5C%20%5C%3C%5C%3C

As this param does nothing, make it so that the code is no longer valid
by removing the eat check params, so devs don't falsely assume the
pattern actually logs.

The original idea for this was suggested by Lei Zhang in
https://crrev.com/c/4027162.

Bug: 1392445

Change-Id: I9d5c2d7b8e48436b2ec819425903a4ba9aa755d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4096037
Owners-Override: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Keith Lee <keithlee@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082189}
2022-12-13 02:58:25 +00:00
Daniel Cheng
ccd5b41390 Use base::test::FeatureRef for feature vectors in //content.
A base::Feature should not be copyable; a feature is intended to have a
single global instance, as it caches internal mutable state.

Feature vectors in conjunction with `base::test::ScopedFeatureList` are
by far the most common use of the base::Feature copy constructor. This
is a mostly automated replacement of `std::vector<base::Feature>` with
`std::vector<base::test::FeatureRef>` to remove that dependency.

This CL was uploaded by git cl split.

R=nasko@chromium.org

Bug: 1370572
Change-Id: Iecfb813c08c475e042234aab91577cff999b4101
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3933905
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1055143}
2022-10-05 06:20:45 +00:00
Arthur Hemery
c2f98e3d1b Remove hidden header dependency.
browsing_context_state.h includes browsing_instance.h but would be fine
with just BrowsingInstanceId. This include is used unknowingly
by other files that construct BrowserContext's sometimes without even
importing browsing_context_state.h in the first place.

Replace browsing_instance.h import by browsing_instance_id.h and
add explicit dependencies where needed.

Change-Id: I629af039b886aa0ce37a3faab1007aca24ffbfbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3926070
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1054176}
2022-10-03 15:37:26 +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
Dave Tapuska
327c06c9c7 Rename GetMainFrame to GetPrimaryMainFrame
Progressively rename some usages of GetMainFrame to GetPrimaryMainFrame.

This is an automated change via git grep & sed.

BUG=1250404

Change-Id: I5e8fda4f11104cf9fcde8a690a33dc6ab7c34f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696741
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013636}
2022-06-13 20:31:51 +00:00
Illia Klimov
27239edc5a The permissions API code cleanup.
PermissionManager contains duplicated methods that differentiate by permissions type enum (ContentSettingsType vs PermissionType). This CL removed most of the ContentSettingsType-related methods, because they had limited usage, mostly in tests.

Methods removed from PermissionManager:
* RequestPermission(ContentSettingsType)
* RequestPermissions(ContentSettingsType)
* RequestPermissionFromCurrentDocument
(ContentSettingsType)
* PermissionManager::RequestPermissionsFromCurrentDocument
(ContentSettingsType)
* GetPermissionStatusForFrame(ContentSettingsType)
* GetPermissionStatusForWorker(ContentSettingsType)
* GetPermissionStatusForFrame(PermissionType)

Methods removed from PermissionControllerDelegate:
* GetPermissionStatusForFrame(PermissionType)

Methods added to PermissionControllerDelegate:
* RequestPermissionsFromCurrentDocument(PermissionType)

Methods added to PermissionManager:
* RequestPermissionsFromCurrentDocument(PermissionType)

Bug: 1271543
Change-Id: I7c718e3a1a390cd5be6f143ad8f7a07477473e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3599030
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Illia Klimov <elklm@google.com>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Quick-Run: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1002151}
2022-05-11 17:14:59 +00:00
Andy Paicu
a6d6d85580 Remove content::PermissionType references and replace them with...
...blink::PermissionType

This is a follow-up of https://chromium-review.googlesource.com/c/chromium/src/+/3359620
which moved PermissionType to blink but left a `using` statement to
avoid modifying a large amount of files in an already complicated
enough CL.

This CL removes that statement and modifies all references to use the
blink type.

Bug: 1122423
Change-Id: Ia2e992d1cb1456bbba72c4d9ee38b74fca8cab1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3593199
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Illia Klimov <elklm@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Daseul Lee <dslee@chromium.org>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997288}
2022-04-28 18:08:36 +00:00
Daseul Lee
cd631a57e7 [Local Fonts] Handle unsupported platform (Android) and permission denied case by throwing an error.
This change partially reverts crrev/c/3547299, as the new decision is to hide the API on Android instead of returning an empty set.

Bug: 1296792
Change-Id: I5ba666d40d2a6ccaf7d33d4420cec37daf8b0e69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3597990
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#995236}
2022-04-22 17:21:48 +00:00
Joshua Bell
2ffc8f1308 Local Font Access: Add dslee@ to OWNERS
Change-Id: I939b89352b406f365f8ee8624e2c25af5651bb62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3587140
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Daseul Lee <dslee@chromium.org>
Commit-Queue: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#993333}
2022-04-18 16:25:22 +00:00
Daseul Lee
16f349573d Update navigator.fonts.query() to self.queryLocalFonts().
Spec PR: https://github.com/WICG/local-font-access/pull/80

This change updates font_manager to font_access, a supplement to window that directly exposes `queryLocalFonts()` method. It also updates the regular WPTs and deletes the obsolete origin trial WPT.

Bug: 1312603
Change-Id: I7c962f5c326f4b945944dbfa939c674bbe71b958
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3584655
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#992670}
2022-04-14 19:37:11 +00:00
Daseul Lee
5ff70483ba [Local Fonts] Rename permission name from FONT_ACCESS to LOCAL_FONTS.
The feature isn't launched yet, and per spec change request (https://crbug.com/1312577#c2), we are modifying the externally visible names first, followed by internal names in the codebase.

Bug: 1312577
Change-Id: I5bb953c5f1b615ffa59307057533a8ceb3a1b850
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3570254
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kamila Hasanbega <hkamila@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#990518}
2022-04-08 19:02:50 +00:00
Victor Costan
62df799cca Update OWNERS around Storage.
Change-Id: Ic2fb2c500aee1f0432923ac6f5d8c46333b846a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3566213
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988220}
2022-04-02 01:49:13 +00:00
Daseul Lee
2e16b34d68 Update README.md for Font Access API.
Change-Id: Ic1be80a3e7144327fe0ddc040fa2eb2bbe95d074
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3564616
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988128}
2022-04-01 21:52:21 +00:00
Daseul Lee
b5c6829c03 Rename FontMetadata to FontData in Blink IDL.
Blink implementation class remains as blink::FontMetadata since there is blink::FontData class already. The class names should be resolved in a future clean-up CL.

Bug: 1311102
Change-Id: Idc070d704f3b0092ed33d652c1dd9c8804b83fe9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3556642
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987929}
2022-04-01 15:47:19 +00:00
Gabriel Charette
bdd68018e8 [base] Remove unused post_task.h includes
This CL is a no-op.

Bug: 1026641
AX-Relnotes: n/a
Change-Id: If45d30e748b65097bb6be666dc305c27183d83ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3555247
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Owners-Override: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987328}
2022-03-31 04:00:05 +00:00
Daseul Lee
621cc4ecb1 Rename QueryOptions.select to QueryOptions.postscriptNames, and update
the empty list for postscriptNames match no fonts, instead of matching
all fonts.

Change-Id: Id361587a0316af3c7512f28c1e60cb47fe3d7611
Bug: 1310341,1310389
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3556637
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#986580}
2022-03-29 17:41:49 +00:00
Daseul Lee
c4bf2a64b8 Rename font_access_manager_impl to font_access_manager.
Change-Id: I3e38608b19c1fdc028957e19124c66a4c0af0a73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3549676
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#985391}
2022-03-25 18:23:59 +00:00
Daseul Lee
c21bd10dd1 Return an empty font list when the permission is not given, or platform implementation is missing (e.g. Android). Also, remove the unused kCanceled status.
Previously in the case of unsupported platform, the browser-side code returned FontEnumerationStatus::kUnexpectedError, while the renderer side handled FontEnumerationStatus::kUnimplementedError even though it would never been thrown under any case. We fix that behavior by updating the browser-side to throw an UnimplementedError, which the renderer handles by returning an empty font list. In general, the browser-side will provide specific information about font enumeration status, and the renderer-side will handle how users will receive the response. Similarly for permission denied or not given cases, the renderer-side will process FontEnumerationStatus::kPermissionDenied into an empty font list.

Bug: 1296792
Change-Id: I5c936a176d49453d3494bbc952831f83512c7db4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3547299
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#985005}
2022-03-24 21:01:33 +00:00
Illia Klimov
f28428456b Add GPSForCurrentDocument() into PermissionControllerDelegate.
As part of the Permission API hardening go/permissions-api-hardening
GetPermissionStatusForCurrentDocument was previously added in
PermissionController. This CL adds
GetPermissionStatusForCurrentDocument into all
PermissionControllerDelegate implementations.

Bug: 1271543
Change-Id: I4d5549aba621891e0745866e739fafbc1b142038
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3525774
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Michael Bai <michaelbai@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Illia Klimov <elklm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#983759}
2022-03-22 11:33:39 +00:00
Daseul Lee
bc16030bcd Update Font Access API tests.
- Add a WPT test case to check for calling blob() from detached frame.
- Add an additional test case for invalid query in font_access_manager_impl_browsertest.
- Check for SharedMemoryMapping validity in font_access_manager_impl_unittest.

Change-Id: Id510aaa6d6e425c40b99ac1d6b7b7b6800f602ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3536428
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Daseul Lee <dslee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#982907}
2022-03-18 22:10:51 +00:00
Illia Klimov
a181b7dda5 Add new API into PermissionController.
This CL adds the following APIs:
1. `RequestPermission()`
2. `RequestPermissionFromCurrentDocument()`

More details here:
go/permission-controller
go/permission-manager-hardening

Bug: 1271543
Change-Id: I80f1ae00aa1ef0afabd00999a89bd58397a5d678
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3498341
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Illia Klimov <elklm@google.com>
Cr-Commit-Position: refs/heads/main@{#981014}
2022-03-15 08:17:47 +00:00
Illia Klimov
4a2cb19aef Add PermissionController::GetPermissionsStatusFor* APIs.
This CL adds the following APIs:
1. GetPermissionStatusForServiceWorker()
2. GetPermissionStatusForCurrentDocument()
3. GetPermissionStatusForOriginWithoutContext()

`GetPermissionStatusForOriginWithoutContext()` is used when context is
not entirely clear. E.g., PAYMENT_HANDLER permission verification for
payment providers inside PWA's manifest.

More details here:
go/permission-controller
go/permission-manager-hardening

Bug: 1271543
Change-Id: I8ddd1f820c57161461e47b81f66cbec6c9afabb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495142
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Yoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Illia Klimov <elklm@google.com>
Cr-Commit-Position: refs/heads/main@{#980989}
2022-03-15 06:31:35 +00:00
Victor Costan
ff9eb46806 Font Access: Move OS-specific logic to FontEnumerationDataSource.
FontEnumerationCache currently has two responsibilities: retrieving font
information from the underlying operating system, and caching this
information.

This CL extracts retrieving font information into a separate class,
FontEnumerationDataSource. This leaves FontEnumerationCache with the
single responsibility of caching the font data.

While moving font information retrieval into FontEnumerationDataSource,
this CL also removes the PLATFORM_HAS_LOCAL_FONT_ENUMERATION_IMPL macro.
All the OS-specific logic is encapsulated in FontEnumerationDataSource
subclasses.

Bug: 1232812
Change-Id: I667ce296fc49567ebd0b928f9744f2300bbb0f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3153688
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#970294}
2022-02-12 03:50:20 +00:00
Xiaohan Wang
1ecfd006fd content: Use BUILDFLAG for OS checking
Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

R=thakis@chromium.org

Bug: 1234043
Test: No functionality change
Change-Id: Ia0eae6f9396065e190929d42600012c9324c07e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3399774
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Owners-Override: Xiaohan Wang <xhwang@chromium.org>
Auto-Submit: Xiaohan Wang <xhwang@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/main@{#961157}
2022-01-19 22:33:10 +00:00
Victor Costan
c4eae8fbd5 Fonts Access: Remove prototype that uses a font picker.
Feedback from developers suggests that the font picker model is not a
useful block in building the experiences that folks are aiming to offer.
Therefore, we're consolidating our prototype around the permission
prompt model.

This CL also removes the FontAccessPersistent feature flag, because its
scope is now equivalent to the FontAccess flag.

Bug: 535764
Change-Id: I0e52562b55bbba4ef6d03c43ad2d988f8744f6bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3383599
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: enne <enne@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#960722}
2022-01-19 00:55:12 +00:00
Joshua Bell
78db61b3f5 Font Access API: Remove additional FontMetadata properties
After further discussions with potential adopters, the priority to
expose synthetic stretch/weight/italic properties in FontMetadata
during enumeration has dropped, so removing them to reduce the surface
area of the API. Developers seem happy to parse fonts to extract
the details. We can revisit as needed.

This effectively reverts 332823ac67

Change-Id: I1b7f3c71760c105d18644de60507a96e247f66c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3353631
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#959940}
2022-01-17 06:17:00 +00:00
Victor Costan
dcddd2653e Allow C++17 structured bindings in Chromium.
Change-Id: Ide96e30476210db59c67c17a950e5b9aed679249
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3356325
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Roland Bock <rbock@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#958211}
2022-01-12 19:20:39 +00:00
Keishi Hattori
0e45c020c4 Rewrite most Foo* field_ pointer fields to raw_ptr<Foo> field_.
DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.

This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e

For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.

FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.

[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ

Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#945735}
2021-11-27 09:25:52 +00:00
Benjamin Lerman
2cdd746591 [font] Add FontEnumerationCache for Fuchsia
Fuchsia doesn't yet handle enumerating available font. For now, hardcode
the available fonts.

Test: FontAccessChooserControllerTest.*
Bug: 1265639 fxbug.dev/8912
Change-Id: I07db4c6b2c72f3952fdb8555bd280923bda1ba1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3282183
Auto-Submit: Benjamin Lerman <qsr@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#942628}
2021-11-17 15:57:09 +00:00
Patrick Monette
643cdf6190 Replace base/task/ temporary forward headers with their final locations
Note to QA: This merely changes includes and should not be blamed
for files it touched.

Bug: 1255932
Change-Id: I1ce4e31efd5792ebf2080812e665cae838a54972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3226943
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#932153}
2021-10-15 19:13:42 +00:00
Patrick Monette
3d7d70920a Replace task-related headers to their equivalent in base/task/
This CL was generated by using tools/git/move_source_file.py to change
the includes for those files:
base/bind_post_task.h
base/deferred_sequenced_task_runner.h
base/post_task_and_reply_with_result_internal.h
base/sequenced_task_runner.h
base/sequenced_task_runner_helpers.h
base/single_thread_task_runner.h
base/task_runner.h
base/task_runner_util.h
base/updateable_sequenced_task_runner.h

Then formatted using "git cl format". DEPS files were fixed with a
simple search and replace script.

Bug: 1255932
Change-Id: I0d9b5ddd9260fde5e4581e6c6e0080bdb0ed2c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3209175
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929867}
2021-10-08 20:27:23 +00:00
Victor Costan
a3042b281f Update OWNERS files.
oyiptong@chromium.org handed off ownership of Chrome work. The Compute
Pressure API specification repository has been transferred to WICG.
This CL updates relevant files to reflect these changes.

Change-Id: Iefe1c282cd9ffffcc9ce9a1990f15545ad7c5562
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3184719
Auto-Submit: Victor Costan <pwnall@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#925876}
2021-09-28 18:59:59 +00:00
Nodir Turakulov
de11715e63 [dirmd] Use metadata mixins
Use the new "mixins" feature in dirmd.
Derive mixins from file:// links in OWNERS files.

This CL is machine-generated, in two parts.

Part 1: use mixins.

1. Save current metadata to JSON files, in ORIGINAL and REDUCED forms.
   dirmd read -form original > ~/tmp/dirmd/original.json
   dirmd read -form reduced  > ~/tmp/dirmd/reduced.json
2. Run mixins.py.
   Source code: https://gist.github.com/nodirg/b59d3df338a72a8944f957c5b3a15e22

The script finds related directories, connected by file:// links
in OWNERS files. For those directories that have the same base
name, e.g.
  components/autofill
  chrome/android/java/src/org/chromium/chrome/browser/autofill
if importing the "parent" to the "child" reduces metadata, or adds
missing metadata, extract the common metadata to COMMON_METADATA
and import it in both directories.

Part2: deduplicate metadata.
Apply same instructions as in
https://chromium-review.googlesource.com/c/chromium/src/+/2795985/16

Bug: 1179786
Change-Id: I2e6378004ce433e02f1c9360b09eb72354083bf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897943
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Fred Mello <fredmello@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Cr-Commit-Position: refs/heads/main@{#925648}
2021-09-28 06:50:47 +00:00
Victor Costan
b6cf888d83 Font Access: Add a WeakPtrFactory to FontAccessManagerImpl.
Bug: 1232812
Change-Id: Ib12cb2c3dbf43fa246b6d8f3c75b362cb1bf17d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3153718
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#920266}
2021-09-10 17:29:17 +00:00
Victor Costan
b8fdc13665 Font Access: Remove threading from FontEnumerationCache.
This CL removes the threading logic from FontEnumerationCache, so
instances are now used on a single sequence.

This simplifies the API between FontEnumerationCache and its subclasses
down to a single ComputeFontEnumerationData() method. A follow-up CL
will extract this API to a separate base class, separating the
responsibility of obtaining font enumeration data from the
responsibility of caching the data.

Bug: 1232812
Change-Id: Ie6a4c25c6b320ec228189592c35557ae1e598243
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3058215
Auto-Submit: Victor Costan <pwnall@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#919844}
2021-09-09 17:02:56 +00:00
Maksim Ivanov
9efa44d35f Fix use-after-move in //content/browser/font_access/
Fix a potential crash due to an optional<> variable being read-from
and std::move()'ed in a loop, as only the first loop iteration will
get a non-empty optional and the next iteration would crash on
dereferencing it.

This issue was found by the bugprone-use-after-move clang-tidy
diagnostics:

  font_enumeration_cache_win.cc:321:
  'family_name' used after it was moved
  font_enumeration_cache_win.cc:321:
  move occurred here
  the use happens in a later loop iteration than the move

Bug: 1122844
Change-Id: Ie66aaf6576638530c073f33d7d611486a857c61a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3127221
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#916253}
2021-08-28 21:27:04 +00:00
Victor Costan
5676ef2e28 Font Access: Remove threading from Windows implementation.
Getting font information from DirectWrite is faster on a single thread,
compared to the current multi-threaded implementation. This is likely
because the single-threaded implementation can omit copying strings and
protocol buffer values, asides from cutting down on the PostTask()
overhead.

This CL subsumes the FontEnumerationCacheWin methods
InitializeDirectWrite(), AppendFontDataAndFinalizeIfNeeded(), and
FinalizeEnumerationCache() in PrepareFontEnumerationCache(). This is
similar to the FontEnumerationCache implementations.

This CL also did the following renames:

* outstanding_family_results -> family_count
* native_postscript_name -> postscript_name (code inclusion)
* native_style_name -> style_name (code inclusion)

Testing methodology:
1a) Add the timing code removed in https://crrev.com/c/3122473/2..3
1b) In the threaded version, the start time was recorded in
    PrepareFontInitializationCache(), and the end time was recorded in
    FinalizeEnumerationCache(). The DirectWrite initialization code was
    moved from SchedulePrepareFontInitializationCache() to
    PrepareFontInitializationCache(), after the start time recording.
2) out\Release\chrome.exe --enable-logging https://oyiptong.github.io/opentype.js/font-inspector-picker.html
3) Click the "Import Fonts" button.
4) Note the time in the log.
5) Close Chrome.
6) Repeat steps 2-5 for each test run. The results below have 10 runs.

Testing results using Windows 10.0.19043 on a Lenovo P53 20QQS56800.

* Multi-threaded times (microseconds):
  7159 7417 6785 7071 7497 6764 8474 6402 6697 8422
* Single-threaded times (microseconds):
  5218 4872 6283 5672 5128 6590 5913 6870 5827 6132

Bug: 1232812
Change-Id: I495bc199d7e9c14c55fccb0ee2b48b7d342f54a5
Tested: manual benchmark described above
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3122473
Auto-Submit: Victor Costan <pwnall@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#915971}
2021-08-27 15:15:01 +00:00