0
Commit Graph

192 Commits

Author SHA1 Message Date
Chris Fredrickson
c0314cc64e Migrate all callers to optional-based GetNormalizedHeader overload
This also deletes the out-param-based overload.

Change-Id: I74b03b454bfaa99ea9b75227511801e50aa0f138
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5939082
Owners-Override: Rick Byers <rbyers@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1370586}
2024-10-18 14:48:51 +00:00
Helmut Januschka
d1d85574fa use std::optional base::GetFileSize() in //c/browser
Bug: 371234479
AX-Relnotes: n/a
Change-Id: Ib9372f83270742844a43b48eba40e03e86b2d91b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5921452
Commit-Queue: Helmut Januschka <helmut@januschka.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368889}
2024-10-15 18:38:16 +00:00
Devlin Cronin
827bf1d741 [Extensions] Enable trial_tokens key on stable channel
Enable the `trial_tokens` manifest key on stable channel to allow
extensions to specify Origin Trial tokens to be served on resources
from their origin.

Bug: 40282364
Change-Id: I981adbe45380527a7f4af3fa78734e0caefad190
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5860285
Auto-Submit: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1355359}
2024-09-13 19:25:27 +00:00
Helmut Januschka
bcf73217bf Shift PowerMonitor to non static
Bug: 346931324
Change-Id: I80fab35a422083c5a9db1d9ee4a2ccd34e11d32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5806403
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1350494}
2024-09-03 23:49:18 +00:00
Michael Maltsev
ef39caebc6 Handle file read errors in extension content verification
This change improves ContentVerifyJob to handle read errors. Several
tests for uncommon scenarios were adjusted, but the verification
behavior is mainly unchanged. This change makes the verification flow
more robust and will help with further improvements.

Bug: 40642940
Change-Id: I60deb1db0f05bdf6ca742538d14872c2cdf44767
Include-Ci-Only-Tests: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5752523
Commit-Queue: Michael Maltsev <michaelm@island.io>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1338684}
2024-08-07 21:43:40 +00:00
Michael Maltsev
a1337ab671 Do not allow requests for paths ending with a separator
Such file paths aren't valid in most platforms anyway, but macOS just
strips the trailing separator when `realpath` is used, which causes
inconsistencies.

Bug: 356878412
Change-Id: Ib74868b027bd5792968149b9cdfadbec9b236563
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5752609
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Michael Maltsev <michaelm@island.io>
Cr-Commit-Position: refs/heads/main@{#1337808}
2024-08-06 13:03:04 +00:00
Maksim Moskvitin
e6dacf3529 Revert "Handle file read errors in extension content verification"
This reverts commit ef037a35bd.

Reason for revert: seems to be culprit for consistent ContentVerifierTest failures on Mac builders. See crbug.com/356584963 for details.

Original change's description:
> Handle file read errors in extension content verification
>
> This change improves ContentVerifyJob to handle read errors. Several
> tests for uncommon scenarios were adjusted, but the verification
> behavior is mainly unchanged. This change makes the verification flow
> more robust and will help with further improvements.
>
> Bug: 40642940
> Change-Id: I29c840cf306d5d1226cdd6835cccfc4b82bc201d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5713651
> Reviewed-by: Oleg Davydov <burunduk@chromium.org>
> Commit-Queue: Michael Maltsev <michaelm@island.io>
> Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
> Reviewed-by: Tim <tjudkins@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1335357}

Bug: 40642940, 356584963
Change-Id: Ibb82db98be5854414d8150a132fc757fbcb038dd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5752643
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Maksim Moskvitin <mmoskvitin@google.com>
Cr-Commit-Position: refs/heads/main@{#1335383}
2024-07-31 12:15:47 +00:00
Michael Maltsev
ef037a35bd Handle file read errors in extension content verification
This change improves ContentVerifyJob to handle read errors. Several
tests for uncommon scenarios were adjusted, but the verification
behavior is mainly unchanged. This change makes the verification flow
more robust and will help with further improvements.

Bug: 40642940
Change-Id: I29c840cf306d5d1226cdd6835cccfc4b82bc201d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5713651
Reviewed-by: Oleg Davydov <burunduk@chromium.org>
Commit-Queue: Michael Maltsev <michaelm@island.io>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Tim <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1335357}
2024-07-31 10:33:23 +00:00
Michael Maltsev
fcea7453c1 Improve ContentVerifier job creation flow to wait for data to become ready
This change is part of a series of changes to make the verification flow
less asynchronous and more reliable. This change makes job creation
easier to reason about and addresses the TODO that suggests to get rid
of the thread hopping solution which is no longer needed.

Bug: 826584
Change-Id: Ib44e770b57d6fedb3225a71b9cff8765cbc05a2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5712808
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1335146}
2024-07-30 23:04:33 +00:00
Yoshisato Yanagisawa
34de9b9ef7 Enable PlzDedicatedWorker by default except Fuchsia
Also fixed tests that started to fail with PlzDedicatedWorker flag enabled.

- DedicatedWorkerTest.TopLevelFrameSecurityOrigin
  The test double did not have PlzDedicatedWorker support.

- HeadlessProtocolBrowserTest.VirtualTimeWorkerBasic
- HeadlessProtocolBrowserTest.VirtualTimeWorkerFetch
  maybe change checker?  Adjusted values to the value with
  PlzDedicatedWorker.

- MV2/ExtensionProtocolsTest.InvalidBackgroundScriptRequest/0
- MV3/ExtensionProtocolsTest.InvalidBackgroundScriptRequest/0
  While the test think ExtensionURLLoader bans kWorker destination,
  it is allowed if PlzDedicatedWorker is enabled.

Note that I left fuchsia as-is because it needs
https://chromium-review.googlesource.com/c/chromium/src/+/5100024.
I will address that in crbug.com/350785857 in the future.

Bug: 906991, 350775884
Change-Id: Id937ae56b2d713a75b2ce61077741307b2657d14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5671624
Reviewed-by: Shunya Shishido <sisidovski@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Minoru Chikamune <chikamune@chromium.org>
Reviewed-by: Keita Suzuki <suzukikeita@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324648}
2024-07-09 03:35:13 +00:00
Hzj_jie
0416317243 [Fuchsia] Remove BUILDFLAG(IS_FUCHSIA) from //chrome
Except for the chromedriver.

Cq-Include-Trybots: luci.chrome.try:fuchsia-smoke-sherlock,fuchsia-cast-sherlock,fuchsia-fyi-sherlock;luci.chromium.try:fuchsia-fyi-x64-dbg,fuchsia-fyi-arm64-dbg,fuchsia-arm64-cast-receiver-rel,fuchsia-x64-cast-receiver-rel
Bug: 41481724
Change-Id: Id1a79c4bdef69ca7e5e87ac1cd1a86c8fd25e8d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5485913
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Zijie He <zijiehe@google.com>
Cr-Commit-Position: refs/heads/main@{#1293890}
2024-04-29 19:37:16 +00:00
Alison Gale
c1a65bcd1d Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: I0e09a8a2601438083334cfeeea09962d85c2ac8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5465984
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Charles Meng <charlesmeng@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1289415}
2024-04-18 17:28:07 +00:00
Anton Bershanskyi
63a7ed4574 [Extensions] Pass origin trial tokens to mojo
Bug: 40282364
Change-Id: Icfcb978a6c630b5926d4604e2639a80b6973cb7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5423028
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1288277}
2024-04-16 20:29:42 +00:00
Anton Bershanskyi
a10f9e3560 [Extensions] Improve extension protocol unittest
Improve code coverage by writing more extension protocol unittests
for response security headers including Access-Control-Allow-Origin,
Content-Security-Policy, Cross-Origin-Embedder-Policy,
Cross-Origin-Opener-Policy, Cross-Origin-Resource-Policy, and
Service-Worker-Allowed.

Bug: None
Change-Id: I8fcaddb743052e06103c8cdcdf9c343ec69eeac6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5419201
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1286318}
2024-04-12 06:02:41 +00:00
Anton Bershanskyi
e9729d8392 [Extensions] Update extension protocol unittest to MV3
Parametrize tests for testing both MV2 and MV3, setting appropriate
web_accessible_resources and background manifest properties.
No behavior changes.

Bug: 40804030
Change-Id: Icf7b52fd3a755c63e253b51a7985c7279f65da4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5387885
Reviewed-by: 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@{#1279302}
2024-03-27 22:48:56 +00:00
Takuto Ikuta
16b11f84c3 remove unnecessary includes from some test headers
This unnecessary include removal reduces compile time of
chrome_shelf_controller_browsertest.cc from 28.5s to 27.7s.

Compile trace is changed like below.
Before: https://ui.perfetto.dev/#!/?s=14b07141ca2ee18348adbcf2cefd6110933ce24b3d5e7d02ad174257717839f9
After: https://ui.perfetto.dev/#!/?s=13a891f8389d8d6fe3ac98a200581d60ee603166b7c291e9bd142c229393f642

Bug: 324519459
Change-Id: I31afee6fa18b0a43f9af6bb1ca188bf188eeb74e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5320215
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1268075}
2024-03-04 21:59:40 +00:00
Devlin Cronin
92ce39a729 [Extensions] Move content verification files to content_verifier/
Move the following content verification-related files from
//extensions/browser/ to //extensions/browser/content_verifier:
 - content_verifier.cc
 - content_verifier.h
 - content_verifier_delegate.h
 - content_verifier_io_data.cc
 - content_verifier_io_data.h
 - content_verifier_unittest.cc
 - content_verify_job.cc
 - content_verify_job.h
 - content_verify_job_unittest.cc

Bug: None
Change-Id: I733a653ea800dba731530a9f1247ef99205c1f14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5303510
Auto-Submit: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: Justin Lulejian <jlulejian@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1261835}
2024-02-16 19:54:28 +00:00
Arthur Sonzogni
fe132eeb21 Rename {absl => std}::optional in //chrome/
#cleanup

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

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 "^chrome/" \
    | 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>"

echo "IncludeBlocks: Regroup" >> ".clang-format"
echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format"
git cl format
git restore ".clang-format"

git cl format
```


Bug: chromium:1500249
Change-Id: I5f8d179940c7af6a927efbf7e70b972a845a4127
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5192010
Reviewed-by: Anastasiia N <anastasiian@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1247101}
2024-01-15 11:01:04 +00:00
Emilia Paz
2342695f10 [Extensions cleanup] Remove unnecessary extensions namespace
Remove extensions namespace qualifier in code that is already in
namespace extensions.

Bug: n/a
Change-Id: I3dec2180d023339b9d92b26501680f011ec036e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5042512
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Emilia Paz <emiliapaz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227496}
2023-11-21 18:40:06 +00:00
Antonio Sartori
ee7650382f [Identifiability Study] Remove instrumentation from extensions code
This code, which collects UKM metrics for the Identifiability Study,
only triggers behind a flag which is disabled by default. Since we are
not using this code, we should clean it up.

Bug: b/309371204
Fixed: 1414609, 1305273
Change-Id: I954bcc102119feaccceb91dbc1869722df8f6522
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5002404
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Aman Verma <amanvr@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1222272}
2023-11-09 15:01:28 +00:00
Tim Judkins
d9bb2e9dc4 [Code Health] Expand rfh to render_frame_host in c/b/extensions
As per guidance in:
https://google.github.io/styleguide/cppguide.html#General_Naming_Rules

Carried out with a simple grep/sed script for .cc and .h files in
chrome/browser/extensions.

Note: for extension_protocols_unittest.cc, the entire method using 'rfh'
was removed as it was dead code no longer called anywhere.

Bug: N/A
Change-Id: I3dc6d751ac2c0b39323d7023f2f57f63f52c0192
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4680002
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1170210}
2023-07-13 22:55:19 +00:00
Andrew Rayskiy
03d63ba96f [CodeHealth] Replace remaining Dictionary/ListBuilders in c/b/extensions
This CL does the following changes:
* (extensions::)DictionaryBuilder -> base::Value::Dict
* (extensions::)ListBuilder -> base::Value::List
Also removes obsolete .Build() calls on List/Dict builders.

Bug: 1439232
Change-Id: Icc410e9e1b169be90141ee172c5b58f19e50d752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4475149
Commit-Queue: Andrew Rayskiy <greengrape@google.com>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1136160}
2023-04-26 21:27:23 +00:00
John Abd-El-Malek
da8cc13c40 Remove extensions::InfoMap which is no longer needed.
This was used when parts of extensions code ran on the IO thread but that hasn't been the case for a while.

Bug: 990868
Change-Id: I1eff43a394d198faf07d0f63dfd6120895df7551
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401084
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128967}
2023-04-11 22:57:30 +00:00
David Bertoni
d1d34eed14 [Extensions] Remove DictionaryBuilder::BuildDict.
This CL removes this deprecated member function and migrates all call
sites to use DicitonaryBuilder::Build.

Bug: 1187062
Change-Id: I11d3448bef386a8ee38bab085db986c1fe1bd6c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4122706
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: John Lee <johntlee@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1087462}
2022-12-29 01:15:30 +00:00
Muyao Xu
6a90687ee4 [Code Health] Replace DictionaryValue in c/b/extensions/
Bug: 1187061
Change-Id: Ib55d760a0d28a9c7218fe618c3bc7262f469de24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4123309
Commit-Queue: Muyao Xu <muyaoxu@google.com>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1087170}
2022-12-27 20:36:16 +00:00
David Bertoni
4aa9d84917 [Extensions] Remove ListBuilder::BuildList.
This CL removes this deprecated member function and migrates all call
sites to use ListBuilder::Build.

Bug: 1187062
Change-Id: Idcb8af844dbb6ceed53f6cd8e11647117fa781b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4120246
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Tim <tjudkins@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Reviewed-by: Jeroen Dhollander <jeroendh@google.com>
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1087135}
2022-12-27 18:12:11 +00:00
Alex Turner
f1dc689d9e Migrate Extension::Create() argument to base::Value::Dict (part 2)
base::DictionaryValue is deprecated. Once all callers are migrated, the
base::DictAdapterForMigration argument can be moved to base::Value::Dict
too. This cl migrates chrome/{browser,common}/extensions.

Bug: 1187061
Change-Id: I4e6d62ae7d142b13502a93d59c1801da51400066
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4084016
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Auto-Submit: Alex Turner <alexmt@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082826}
2022-12-14 00:24:00 +00:00
Alex Turner
63c68151ac Migrate from DictionaryBuilder::Build() in c/{b,c}/extensions
DictionaryBuilder::Build() is deprecated and should be replaced with
BuildDict(). Also migrated some uses of ListBuilder::Build() and other
deprecated base::Value types. This cl migrates all of //chrome/{browser,
common}/extensions except the api subdirectory handled in
crrev.com/c/4091443

Bug: 1187061
Change-Id: Ifd91205aad39330c4023d79499b9534c844ddafe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4089472
Auto-Submit: Alex Turner <alexmt@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082088}
2022-12-12 22:44:16 +00:00
Lei Zhang
5ca8dd24be Remove base::test::ParseJsonDeprecated() usage in //chrome.
Replace with base::test::ParseJson() and adapt to existing code using
base::Value::ToUniquePtrValue() when needed.

Bug: 932873
Change-Id: I75f595e850ead17b929c6b7d8fd1380bae86fae4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3940550
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1057335}
2022-10-11 06:56:02 +00:00
Avi Drissman
4a8573cb24 Update copyright headers in chrome
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34, except for the sweep for "All Rights
Reserved" as that generates a lot of exceptions and will be a follow-
up.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I5caf6b21db9c12bea71258223f59c1ac4313a738
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3888258
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1045289}
2022-09-09 19:35:54 +00:00
Dave Tapuska
6aea6e2a8a Rename GetMainFrame to GetPrimaryMainFrame
Progressively rename some usages of GetMainFrame to GetPrimaryMainFrame.

This is an automated change via emacs xref integration via codesearch
restricted to chrome/*

BUG=1250404

Change-Id: Ib5bcebf5e12631eb4823ac393921334b0b68f27a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3687769
Owners-Override: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011128}
2022-06-06 21:21:51 +00:00
David Bokan
98aabfe93c [mparch] Add IsOuterMostMainFrame to NavigationRequestInfo
In light of fenced frames, most instances of is_main_frame on
NavigationRequestInfo are more appropriate as is_outermost_main_frame
(see mini-audit [1]).

This CL plumbs through the is_outermost_main_frame value and does a
rename along the usage chain to make clear exactly what kind of main
frame is being talked about.

There is at least one case that does need to use is_main_frame (to set
update_first_party_url_on_redirect) so that member is kept as well.

[1]https://docs.google.com/document/d/14DkSRzQMiC8Ql1BiUq-WYiTV6uX0jd32cSJP2F9cp3Y/edit?hl=en&forcehl=1#

Bug: 1314749
Change-Id: Id0ab418fa461d96c1f545a1b7edc14ebd138bad5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3584208
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#992367}
2022-04-14 02:10:12 +00:00
Daniel Cheng
7d9e3d578c Migrate base::{size,empty,data} to STL equivalents in //chrome.
Bug: 1299695
Change-Id: Iee0f1211ad9340cebd00beda2c13b901d9ef1cf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3491805
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975444}
2022-02-26 09:03:24 +00:00
Morten Stenshorne
4290f7c1a3 CodeHealth: Modernize DictionaryValue::Set* in chrome/browser/extensions
Some special attention was required due to crbug.com/949461 - had to
leave one SetString() behind in test_extension_prefs.cc. In other cases
(in chrome_app_sorting_unittest.cc), it could be worked around by simply
avoiding SetStringPath(keys::kApp, ...) if it's immediately followed by
something that was expected to overwrite it. kApp is "app", and if we
then try to set the path "app.launch.web_url" or
"app.launch.local_path", SetStringPath() will fail and do nothing,
whereas SetString() will overwrite it.

Bug: 1187025, 1187026, 1187028
Change-Id: Ic70bc3346faac66668221dd22408903e2970e69c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3452303
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#970517}
2022-02-14 08:13:39 +00:00
Tal Keren
9ba46e15e4 [Extensions] Don't trigger unload event for already unloaded extension
The core of this bug was that ExtensionService::BlockAllExtensions
removed the extension from the enabled/disbled/terminated lists before
unloading it, so ExtensionRegistrar couldn't know the state of the
extension which caused incorrect notifications. ExtensionService
shouldn't modify those lists, and shoud let RemoveExtension function of
ExtensionRegistrar handle them instead.
So now RemoveExtension handles terminated extensions too, and doesn't
handle blacklisted/blocked extensions. (it handled them before the same
as enabled extensions)

After this patch, ExtensionRegistrar is the sole mutator of the enabled,
disabled and terminated lists, so we can be sure that ActivateExtension
will never be called twice for the same extension and
DeactivateExtension will never be called when the extension is not
loaded (ExtensionRegistrar guarantees it as it always calls
ActivateExtension/DeactiveExtension together with AddEnabled/
RemoveEnabled and vice versa)

UnregisterExtensionWithRequestContexts is now only called from
DeactivateExtension (as RegisterExtensionWithRequestContexts is only
called from ActivateExtension), so removing disabled and terminated
extensions won't cause unnecessary double notification that won't be
handled anyway. The reason argument was removed as it is not needed
anymore.

New DCHECKs were added to ensure that all the notifications are valid.

Bug: 708230, 1289269
Change-Id: I7fec0e1d1844ad295b1683d6120da0df1540dd95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3402210
Reviewed-by: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Junbo Ke <juke@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#963079}
2022-01-25 18:13:59 +00:00
Tarun Bansal
bcd62c80d4 Remove previews state usage
This can be removed as the feature is not launching.

Change-Id: I709460f82d45b9a17447fc14279adc8d2d4c53d0
Bug: 1285486
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3374256
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Charles Reis <creis@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Reviewed-by: Ian Vollick <vollick@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#960459}
2022-01-18 17:27:38 +00:00
Xiaohan Wang
be233b6e0e chrome/browser/extensions/: 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: Ia7cf118b7597ee578cb8139d863354024c8eeb2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373898
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Owners-Override: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#959319}
2022-01-14 19:15:53 +00:00
Kevin Marshall
86283395a3 [fuchsia] Fix failing ExtensionProtocolsTests.
* Fixes bug in which null-timestamped resources weren't getting stamped
  with ETag headers. This was causing issues in test code because files
  served under /pkg are reported as having null timestamps.
* Disables portions of tests which rely on platform chmod support.

Bug: 1238790
Change-Id: Iba1f69c349f8c9cf39007c3ecd1b798fa5b24422
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271882
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940483}
2021-11-10 21:04:44 +00:00
Peter Boström
53c6c595ce Replace DISALLOW_COPY_AND_ASSIGN in chrome/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I882202fb6295332b52c34ba12fae4705276b0b5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3165772
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#922479}
2021-09-17 09:41:26 +00:00
Peter Kasting
42e82e9cec Fix some instances of -Wshadow.
Bug: 794619
Change-Id: Iffa62524418501b3ad248fbce8d4892855163d1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3160858
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#921692}
2021-09-15 16:39:17 +00:00
mark a. foltz
c4f6a5d282 [Media Router] Remove references to extension IDs from extensions.
This removes references to Media Router component extension and Cast
extension IDs from extensions code.  Both of these extensions are
obsolete and no longer in use.

Bug: 1097594
Change-Id: If1f73c91798b1be467aeef88ba637ea67efacd4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3059520
Commit-Queue: mark a. foltz <mfoltz@chromium.org>
Reviewed-by: Ryan Keane <rwkeane@google.com>
Reviewed-by: Ben Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#907245}
2021-07-30 20:58:49 +00:00
Lei Zhang
1f46798c5e Swap from base/stl_util.h to cxx17_backports.h in chrome/ .cc files.
base::size() has been moved to base/cxx17_backports.h, so .cc files that
use base::size(), but no other function from base/stl_util.h, can
directly include base/cxx17_backports.h and not base/stl_util.h.

Bug: 1210983
Change-Id: Ibfe011ed27d6c3dfa0c6aed30844facff5b8d278
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2915462
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#886558}
2021-05-26 01:35:18 +00:00
Anton Bikineev
46bbb9795f chrome: Replace base::Optional and friends with absl counterparts
This replaces:
- base::Optional -> absl::optional
- include "base/optional.h"
  ->
  include "third_party/abseil-cpp/absl/types/optional.h"
- base::nullopt -> absl::nullopt
- base::make_optional -> absl::make_optional

Bug: 1202909
AX-Relnotes: n/a.
Change-Id: If011b89bfb5f3561e152aeee242b0b2fe1ab4587
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897520
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883266}
2021-05-15 17:53:53 +00:00
Etienne Bergeron
0947997624 Rename files to power_monitor_test[.h|.cc]
This CL is renaming the files power_monitor_test_base[.h|.cc] to
power_monitor_test[.h|.cc] since the suffix base doesn't represent
any classes defined in that file.

This CL has no behavior change.

R=fdoray@chromium.org

Bug: 1188692
Change-Id: Ie1f72425bb71becba7f0884e1089a7ac9c541a36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2821851
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Owners-Override: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#871918}
2021-04-13 13:23:45 +00:00
Ramin Halavati
94e457276d Remove default value of Profile::GetOffTheRecordProfile()
Removes the default value of the newly added |create_if_needed|
aregument of Profile::GetOffTheRecordProfile() and updates all use cases
with adding the new argument.

This CL does not change any behavior.

AX-Relnotes: n/a.
Bug: 1191315
Change-Id: Ifdfbc045529f27ad5baa5a7e92092be1a17fc2f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2794485
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#871904}
2021-04-13 12:27:51 +00:00
Etienne Bergeron
53917b5094 Re-enable flaky test caused by PowerMonitor
This CL is changing the unittest code to use a Mock PowerMonitor
to avoid any risk of flakiness. Previously, the PowerMonitorSource
was not removed and can cause other tests that requires
PowerMonitor to fail.


R=fdoray@chromium.org

Bug: 921687, 1188692
Change-Id: I2d889bf5f288852dbe5dd9d6e86d6d42f178a27d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2800192
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#869683}
2021-04-06 20:23:56 +00:00
Gyuyoung Kim
2e954c43b8 Replace all uses of Manifest::Location enum with Mojo type (4/n)
As a pre-work to convert ExtensionMsg_Loaded to Mojo, this CL
replaces uses of Manifest::Location enum type with
extensions::mojom::ManifestLocationType progressly because it's
a too huge work to convert them at once.

As the fourth step, this CL converts the native type to
Mojo type in Extension::LoadExtension() method and constructs
of ExternalProviderImpl, and so on.

AX-Relnotes: n/a

Bug: 1146100
Change-Id: I2e2266ee9f8f1e6e145cafc10c757526b7f0d394
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2763945
Reviewed-by: proberge <proberge@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Anatoliy Potapchuk <apotapchuk@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#864637}
2021-03-19 14:06:29 +00:00
Gyuyoung Kim
abc233848f Replace all uses of Manifest::Location enum with Mojo type (2/n)
As a pre-work to convert ExtensionMsg_Loaded to Mojo, this CL
replaces uses of Manifest::Location enum type with
extensions::mojom::ManifestLocationType progressly because it's
a too huge work to convert them at once.

As the second step, this CL converts the native type to
Mojo type in Extension::Create() method.

AX-Relnotes: n/a

Bug: 1146100
Change-Id: Ifd84d87a86dbd9014fe6c6979c0d92bb38b8472d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2757592
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#864093}
2021-03-18 03:09:18 +00:00
Dave Tapuska
28226d0410 Remove routing_id from CreateLoaderAndStart
The routing_id parameter represented the view's routing ID for the
associated load. It is unused now so it can be removed.

BUG=1173710

Change-Id: Icdab0441f78530e468392e2f0261e4153959b666
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Owners-Override: Kinuko Yasuda <kinuko@chromium.org>
Owners-Override: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#863748}
2021-03-17 14:21:29 +00:00
Gyuyoung Kim
d140658b71 Replace all uses of Manifest::Location enum with Mojo type (1/n)
As a pre-work to convert ExtensionMsg_Loaded to Mojo, this CL
replaces uses of Manifest::Location enum type with
extensions::mojom::ManifestLocationType progressly because it's
a too huge work to convert them at once.

As the first step, this CL converts the native type to
Mojo type in ExtensionBuilder::SetLocation() method.

AX-Relnotes: n/a

Bug: 1146100
Change-Id: I64375c9173cb8d24f1eb9b0ef967caa0877f9258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752666
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#863207}
2021-03-16 10:06:22 +00:00