0
Commit Graph

129 Commits

Author SHA1 Message Date
6718b706ff C++11 std::array rewrite for memory safety [18/19]
Split from:
https://chromium-review.googlesource.com/c/chromium/src/+/6004959/21

Generated patch
---------------
- Tool: ./tool/clang/spanify/rewrite-multiple-platform.sh
- Platform: Linux.
- Filter: This includes 2400/4222 patches. I included the std::array
      ones and excluded build errors.

Google announcement:
--------------------
https://groups.google.com/a/google.com/g/chrome-memory-safety/c/RMiO4gaVLQA/m/Yz-3NCObAgAJ

Benchmarks:
----------
See design doc and
https://chromium-review.googlesource.com/c/chromium/src/+/6004959/21

Description
-----------
The consensus during the memory safety summit was to begin rewriting
relevant C-style arrays to C++11 std::array. It can be done immediately,
offers better developer ergonomics, and fix large chunks of the
-Wunsafe-buffer-usage errors in Chrome.

To clarify, this effort is complementary to the longer plan work with
enabling -fsanitize=array-bounds, and we plan to leverage both,
especially for protecting 3p code.

[Attached] is a document detailing the rationale, benefits, and
considerations for potential compile-time and performance impacts.

[Attached]:https://docs.google.com/document/d/1z5aBDg26lHmNDjXRCysElWKx7E4PAJXqykI_k7ondJI/edit?tab=t.0#heading=h.cqgo7wvp0kzt

NO_IFTTT=No need to update base/debug/stack_trace.h

Bug: 378069401
Change-Id: I985601e93e79a72d984de78d23670ae214a7d630
R: dcheng@chromium.org
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6043827
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404094}
2025-01-09 02:49:10 -08:00
1d46b660b7 Remove IS_CHROMEOS_ASH from //components/*
This cleans up the following subdirectories: pref_registry,
printing, proxy_config, reduce_accept_language,
renderer_context_menu, rlz, search_engines,
security_interstitials, segmentation_platform,
send_tab_to_self

1) Removed IS_CHROMEOS_LACROS usages and code it guarded
2) Renamed IS_CHROMEOS_ASH to IS_CHROMEOS
3) Removed chromeos_buildflags.h includes
4) Cleaned up *.gn files from IS_CHROMEOS_*.

Bug: 375523816, 373972275, 373971535
Change-Id: Ibd4fb3fa57add29cebaccf74a79e274007f05b04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097669
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Andreea Costinas <acostinas@google.com>
Cr-Commit-Position: refs/heads/main@{#1397793}
2024-12-18 01:27:00 -08:00
77d2135a33 Migrate remaining NOTREACHED()s in components/
NOTREACHED() and NOTREACHED_IN_MIGRATION() are both CHECK-fatal now.
The former is [[noreturn]] so this CL also performs dead-code removal
after the NOTREACHED().

This CL does not attempt to do additional rewrites of any surrounding
code, like:

if (!foo) {
  NOTREACHED();
}

to CHECK(foo);

Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.

Bug: 40580068
Change-Id: I72205fb77747957c6bf33dbea93656fd20085a42
Low-Coverage-Reason: OTHER Should-be-unreachable code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6010008
Reviewed-by: Rick Byers <rbyers@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1382618}
2024-11-13 22:26:11 +00:00
47cd52857f components: default the user-defined empty ctor and dtor where possible
I need an owner's approval please for changes under:
components/proxy_config

This is a mechanical change. There are a few instances (but not all)
of empty user-defined constructors and destructors which can be
defaulted in the /components code.

This CL was uploaded by git cl split.

R=stevenjb@chromium.org

Bug: 371316188
Change-Id: Iab23b9f3f940b2d6983de54e16e27c50a488703e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5918673
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Auto-Submit: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Andreea Costinas <acostinas@google.com>
Cr-Commit-Position: refs/heads/main@{#1366817}
2024-10-10 14:30:43 +00:00
254f694580 Allow quic proxy parsing for the command line flag: --proxy-server=.
This change adds the capability of QUIC proxy support  in debug builds
ONLY.

Outside of unit tests, these behaviors were tested in an actual local
build to verify existing and new behaviors. The tests are described
here:
https://docs.google.com/document/d/1Q7Ek3JeGF3ddqrglsX-995AFEjyS8G4GEd6cwLeKAfs

Bug: 346974102
Change-Id: I56aeb772dd9e11688f2a472c14405d6f0432ae4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5874367
Reviewed-by: Andreea Costinas <acostinas@google.com>
Commit-Queue: Abhi Patel <abhipatel@chromium.org>
Reviewed-by: Dustin Mitchell <djmitche@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1358254}
2024-09-20 17:35:51 +00:00
9ee7c7a6ef Allow command line parsing for bracketed URIs through the
`--proxy-server=` flag.

This change adds the capability of general multi-proxy chains in debug
builds ONLY.

Outside of unit tests, these behaviors were tested in an actual local
build to verify existing and new behaviors. The tests are described
here:
https://docs.google.com/document/d/1T8H3U9oT8GOrLAwSTYRHRs_FUxnQORCHoKywCxe-c4E/edit?usp=sharing

Bug: 346974103
Change-Id: I081328af1eeb4dd91c9bf2be28f63a223a49d0d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5858064
Reviewed-by: Andreea Costinas <acostinas@google.com>
Reviewed-by: mmenke <mmenke@chromium.org>
Reviewed-by: Dustin Mitchell <djmitche@chromium.org>
Commit-Queue: Abhi Patel <abhipatel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1356508}
2024-09-17 16:16:41 +00:00
b948e67a9c spanification: Add #pragma allow_unsafe_buffers to component/*
See `//docs/unsafe_buffers.md`

This is a preparation to fix each files.
This CL has no behavior changes.

This patch was fully automated using script:
https://paste.googleplex.com/5614491201175552

See internal doc about it:
https://docs.google.com/document/d/1erdcokeh6rfBqs_h0drHqSLtbDbB61j7j3O2Pz8NH78/edit?resourcekey=0-hNe6w1hYAYyVXGEpWI7HVA&tab=t.0

AX-Relnotes: n/a.
Bug: 40285824
Change-Id: I24ff0aee7a6cbe6da11a08830135449ccf8f2ae2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5717711
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1335315}
2024-07-31 08:29:04 +00:00
aaf19db38d Use NOTREACHED_IN_MIGRATION() in components/
This was generated by replacing "  NOTREACHED()" with
"  NOTREACHED_IN_MIGRATION()" and running git cl format.

This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.

Bug: 40580068
Change-Id: I92e83d0b564d44267f003147a1ce6ba3674621a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539175
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1300923}
2024-05-14 22:08:09 +00:00
939685f4a4 [ios] Remove ios/web/public dependency from public_deps in ios/web:web
change in ios_internal/: https://chrome-internal-review.googlesource.com/c/chrome/ios_internal/+/7241376

public_deps in ios/web/BUILD.gn should not have private files.
See the best practice: https://g3doc.corp.google.com/home/g3doc/devices/platforms/cast/reference/build-gn-best-practices.md?cl=head#public-deps-vs-deps

This CL removes "//ios/web/public" from ios/web:web and updates other
BUILD.gn to explicitly include "//ios/web/public" and other
dependencies.

Bug: 338033944
Change-Id: I5ad84c69823d1d5bee05178838d75aa133ee1ad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5498364
Commit-Queue: Éric Noyau <noyau@chromium.org>
Auto-Submit: Asami Doi <asamidoi@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Éric Noyau <noyau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295969}
2024-05-03 07:26:11 +00:00
94d6737e27 Remove pmarko from OWNERS in /components/proxy_config
My open source capactiy will be lower than my @google.com capacity, so
accounting for that.

This CL was uploaded by git cl split.

R=stevenjb@chromium.org

Bug: none
Change-Id: Id87c38327d89df925f2e9ae188c4226cd52886e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5485947
Auto-Submit: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Andreea Costinas <acostinas@google.com>
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293000}
2024-04-26 13:26:41 +00:00
b8be952f6c 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: I89f0a4d7ddeb7c9585f3a0e5421aef8ce5a6f0f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5455854
Reviewed-by: Taylor Bergquist <tbergquist@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1287738}
2024-04-16 00:00:31 +00:00
da0e294bba Mark name_to_extension_prefpath as constexpr.
This was actually being initialized at runtime, since the initializer
was not a constant expression. base::MakeFixedFlatMap is stricter and
requiring consteval, so fixing this consists of two parts:
- marking `name_to_extension_prefpath` itself as constexpr
- making all the pref constants as constexpr

Incidentally, this fix also makes the pref name constants actually
constant, as a `const char*` can still be assigned.

Note that using inline constexpr variables has some implications in
component builds: specifically, it is possible for the constants to be
built into multiple discrete components, breaking things that rely on
pointer identity. This dependency does not seem to be there in practice,
and Chrome should prioritize optimizing for production builds that ship
to users over developer-only component builds.

Bug: 41486252
Change-Id: Iec7ce681ec4e0054530a460363f1271a1159d56a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5375296
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1274207}
2024-03-18 16:28:49 +00:00
fedd6e0d6a Update components/proxy_config/OWNERS
Bug: none
Change-Id: I75c9e0ef149bf2f54ad37d296c559c8aad799f3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5277253
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Andreea Costinas <acostinas@google.com>
Cr-Commit-Position: refs/heads/main@{#1259717}
2024-02-13 08:51:17 +00:00
c571efbef3 Rename {absl => std}::optional in //components/
#cleanup

Automated patch. This is a no-op. Please avoid, to assign unrelated
bugs to this, as much as possible.

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 "^components/" \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
    | grep -v \
      -e "components/cast_streaming/browser/public/receiver_config.*" \
      -e "components/power_metrics/*" \
      -e "components/zucchini/patch_reader.*" \
    | sort \
    | uniq \
    | 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 "Formatting:"

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: I34b45aba082a627d94fd9d3f9f994a60c64b40b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5200092
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1252820}
2024-01-26 20:26:18 +00:00
181fb16664 Move class member functions for ProxyPolicyHandler
Functions that do not use the internal state of the class have been
moved from the class to an anonymous namespace.
These functions are helper functions.

Bug: NONE
Change-Id: Ic362e5e4d366dff77b4096155e0afc3300466ee5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5116255
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Александр Жиров <a.zhirov@corp.mail.ru>
Cr-Commit-Position: refs/heads/main@{#1250288}
2024-01-22 18:20:06 +00:00
819ae2ef48 Replace ProxyList::Get calls with ProxyList::First
Bug: 1491092
Change-Id: Ib320d93e722a4b3cf07721eaf9c6a02ff360f82e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5044890
Commit-Queue: Ciara McMullin <ciaramcmullin@google.com>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Chad Duffin <chadduffin@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230019}
2023-11-28 18:25:11 +00:00
1b262d4ca0 Remove redundant ARC configuration in /components
ARC is now enabled by default, so enabling it at the target level is
redundant and can be removed.

Bug: 733237
Change-Id: I73b360e8311c194e5d9919816c50d994f0405624
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4721409
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Commit-Queue: Cait Phillips <caitkp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1176219}
2023-07-27 19:23:58 +00:00
6d20445e20 [Ash] Use the Prefs service to observe extension-set proxies
Currently extension-set proxies are intercepted by the
LacrosExtensionProxyTracker which sends the proxy config along with the
extension metadata to Ash using the NetworkSettingsService mojo service.
The NetworkSettingsService stores the new proxy config using the kProxy
pref, in the user store.

This CL changes the the NetworkSettingsService implementation in Ash
to (indirectly) use the Prefs mojo service to get the proxy config set
by the Lacros primary profile and modifies the
LacrosExtensionProxyTracker to only set and clear extension metadata.

This CL also removes all the logic which monitors proxy updates
outside of NetworkSettingsServiceAsh.

Bug: 1411949, b/267135604, b/192453302

Change-Id: I8fbf828eba88acdd20f536f8e8893239425d1a8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4218357
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Roland Bock <rbock@google.com>
Commit-Queue: Andreea Costinas <acostinas@google.com>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1170082}
2023-07-13 19:29:34 +00:00
e98d214c48 DanglingPointer: annotate for unittests base+linux [1/N]
The DanglingPointerDetector is configured only when the test enters the
ContentMain function. See https://crbug.com/1400059

I would like to configure it no matter the kind of test. For this to
happen, we need to annotate every pre-existing dangling pointers.

This patch annotates the ones you can find by running targets depending
on the GoogleTest library.

Statistic:

This adds 1776 new DanglingUntriaged. Among them:
- 1288 are in unittests.
- 488 are in implementation.

To produce those numbers, I used the command:
```bash
git diff annotate-linux origin/main -- "*test*" | grep "DanglingUntriaged" | wc -l
```

This patch has been generated by:

1. Apply the "auto-annotator" patch:
   https://chromium-review.googlesource.com/c/chromium/src/+/4474553

2. Compile the compiler again:
   ```bash
   ./tools/clang/scripts/build.py
   ```

3. List and run all the targets. You can use a bash script like:
   https://docs.google.com/document/d/1AMMERcqy0eafFWopUCHYsIKIKEp3J8DFxqW9UIbzIHo

4. Concatenate output, filter by "Found dangling ptr", sort, remove
   duplicate.

5. Apply the rewriter script from:
   https://github.com/ArthurSonzogni/chrome-dangling-ptr-apply-edit

6. Revert the "auto-annotate" patch.

7. Apply `git cl format`

AX-Relnotes: n/a.
Bug: chromium:1400059
Change-Id: I217d5c0b925da5176fc53baf95919a3690f1e9a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570424
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151859}
2023-06-01 15:02:25 +00:00
68651c2080 [Code Health] Migrate base::Value::SetBoolKey to v2 API
Bug: 1187001
Change-Id: I357e4bf557460b3a6a3253cc3c6a63d9a47cc728
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4394433
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Liza Bipin <mlbipin@google.com>
Cr-Commit-Position: refs/heads/main@{#1125984}
2023-04-04 15:06:43 +00:00
9d8e9c4f3a Don't make ProxyConfigPollerClient mojo calls if the platform ProxyConfigService doesn't need it.
Only Windows and iOS use this callback.

Bug: 1425174
Change-Id: Idf406a2256d6e07d91f12b1b736950c86506b77a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4348673
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1118470}
2023-03-17 01:03:32 +00:00
e9909597c9 [Code Health] Use Value::Dict::empty() in //chrome and //components
Replaces the use of Value::DictEmpty() with Value::Dict::empty(). No
functionality changed.

Bug: 1187001
Change-Id: I4845f1464cea3db0b4c946d77717c7a95a901428
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4322878
Commit-Queue: Emilia Paz <emiliapaz@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1117777}
2023-03-15 21:57:54 +00:00
d2a736f985 Remove base::Value::Type::DICTIONARY
It is deprecated in favor of base::Value::Type::DICT, so change uses
of it to the new name and remove the enum value.

Fixed: 1291670
Change-Id: I26136fcb723e7dff1f5ffe3990d7011b18c16a43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4198081
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1098238}
2023-01-28 02:31:26 +00:00
537a18035c Update Proxy Config Annotations with ProxySettings
Following investigation of Proxy Config (b/256927321), the annotations
mentioning 'ProxyMode', 'ProxyServer', or 'ProxyPacUrl' policies should
be updated to ProxySettings. The former policies are deprecated.
'ProxySettings' encapsulates the former policies and can control
proxy settings.


Fixed: b:263157378
Change-Id: Ic932ca64b5adf1d6c4f713a0ee161e42ae50bd6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4131463
Reviewed-by: Adam Rice <ricea@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Alex Chen <alexwchen@chromium.org>
Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091934}
2023-01-12 18:17:05 +00:00
12be03159f Update header includes for /base/functional in /components
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: I3179c6b5879e1e2d5a5f4990484b9a85f8548809
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4152595
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091229}
2023-01-11 09:16:09 +00:00
82c14023e0 Add DIR_METADATA file for networking team
Bug: None
Change-Id: I9ef0e6092319f0adea232915d41714f89bcfcb09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4055534
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Stefan Radig <srad@google.com>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1077515}
2022-11-30 17:18:06 +00:00
5b9af51fdd task posting v3: moving away from ThreadTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5824001174667264

This will do a few sed-like modifications, changing calls to methods of
ThreadTaskRunnerHandle to calls to methods of
SingleThreadTaskRunner::CurrentDefaultHandle, and swapping includes.

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: Ia33b6dfebb15937481c619f5c838720ce7bb2676
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031817
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074085}
2022-11-21 15:32:47 +00:00
21c16e238b [Code Health] Migrate ProxyConfigDictionary to base::Value::Dict
This cl migrates ProxyConfigDictionary (see
components/proxy_config/proxy_config_dictionary.h) to use
base::Value::Dict, most of the changes are directly propagated from
there. Besides that it expands TestingPrefServiceBase (see
components/prefs/testing_pref_service.h) interface with setters taking
base::Value::Dict and base::Value::List which allows to avoid manual
conversion to the base::Value on the call side in many tests.

LOW_COVERAGE_REASON=Code Health type migration, nothing new to test

Bug: 1187061, 1187001
Change-Id: I0dbca1a78b3c0a4f313f364f3d2fc35378ccf273
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3922202
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Andrey Davydov <andreydav@google.com>
Cr-Commit-Position: refs/heads/main@{#1053030}
2022-09-29 16:19:45 +00:00
8ba1bad80d Update copyright headers in components/
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: If6a3370b0b2849d889ce797596fe1ccbad2f3fe6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891619
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046502}
2022-09-13 19:22:36 +00:00
6edc4b7de3 Replace PrefService::GetValueDict and PrefService::GetValueList
Semi-final step go/trust-your-prefs#heading=h.jjuz6fybcx8y

Introduce
 - PrefService::GetDict and
 - PrefService::GetList

as drop-in replacements for

 - PrefService::GetValueDict and
 - PrefService::GetValueList

and replace all known call sites via

sed -i 's/\bGetValueDict\b/GetDict/g' $(ag -l -s '\bGetValueDict\b')
sed -i 's/\bGetValueList\b/GetList/g' $(ag -l -s '\bGetValueList\b')

The final step will be to remove GetValueDict and GetValueList in a
follow-up CL.

Bug: 1334665
Test: Existing unit tests
Change-Id: I093e81af89628a02216501e59c1de7f1e5e22b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3887802
Auto-Submit: Roland Bock <rbock@google.com>
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@{#1045895}
2022-09-12 17:33:01 +00:00
2d1871f6e1 Unify and improve policy errors with error path
Error paths from policy errors are now all forged inside the
policy_error_map. DictSubkeyPendingErrors, ListItemPendingErrors
and SchemaValidatingPendingErrors were removed in favor of the
new error path creation.

Bug: 1313477
Change-Id: I797298c402e495624b5358564d34ac4737f81777
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3780808
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Erik Staab <estaab@chromium.org>
Commit-Queue: Leon Masopust <lmasopust@google.com>
Reviewed-by: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1037905}
2022-08-22 20:05:33 +00:00
11e5b22f09 Refactor ProxyConfig to use PrefService::GetValueDict
This is part of a larger migration effort based on
go/trust-your-prefs.

Bug: 1341996
Test: Existing unit tests
Change-Id: Ie47b88996141c27d69e5bf0a82d8b83d12561b3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3827220
Commit-Queue: Roland Bock <rbock@google.com>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1035939}
2022-08-17 06:33:20 +00:00
2e73f8b90f [Code health] Avoid Value::GetAsDictionary (in /components/proxy_config)
This method is deprecated, so port away from it, along with other nearby deprecated base::Value APIs that can be modernized at least somewhat locally.

This CL was uploaded by git cl split.

R=pmarko@chromium.org

Bug: 1187011
Change-Id: Ia56c4d545fd96fd5a42398fcee59baf458850002
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3825868
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Auto-Submit: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1035055}
2022-08-15 14:53:42 +00:00
427ff7a6d3 Migrate //chromeos/ash/components/network to namespace ash [9/N]
This CL migrates remaining files to namespace ash from chromeos.

This CL is part of the Chrome OS source code directory migration:
https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE.

Bug: 1164001
Change-Id: If75617355585da7891a52236dc8b472d561eb227
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3815105
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Yeunjoo Choi <ychoi@igalia.com>
Owners-Override: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032884}
2022-08-09 06:11:08 +00:00
44d6cc3227 Stop generating unsupported policies on ios
Bug: 223616
Change-Id: Ia66889e6d7b8ec55d37dd42f477ed645cbd840ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3747076
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Auto-Submit: Yann Dago <ydago@chromium.org>
Reviewed-by: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1023820}
2022-07-13 17:46:25 +00:00
31c169bbc1 [Code Health] Move CreateSystemProxyConfigService to ProxyConfigService.
This CL is pure refactoring.
This CL moves ConfiguredProxyResolutionService::CreateSystemProxyConfigService
to ProxyConfigService because:
- ConfiguredProxyResolutionService::CreateSystemProxyConfigService
 creates *NOT* ConfiguredProxyResolutionService instance but ProxyConfigService instance depending on platforms.
- ConfiguredProxyResolutionService instance lives on the network service
but ProxyConfigService on the Browser UI thread.

Change-Id: I05869c5e479c39a6aadf9698a58a3287f28ee1a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3692900
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: Rainhard Findling <rainhard@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1021990}
2022-07-08 03:22:21 +00:00
fe03e8ad38 Constify kDeprecatedProxyPolicies array
In proxy_policy_handler.cc kDeprecatedProxyPolicies was a mutable array.
Make it immutable so that hopefully the compiler will place it in a
read-only section of the binary.

Also make the kProxyModeValidationMap array constexpr while we are here.

BUG=1317612

Change-Id: I63bebeb043949b10626d260c690a02e1828573ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3615596
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Auto-Submit: Adam Rice <ricea@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#998335}
2022-05-02 13:37:38 +00:00
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
57db32ff25 Migrate policy value accessors to typesafe versions.
This covers various files missed in previous CLs.

Reasons for using "unsafe" over type-checking versions:
- Handling multiple policies and types
- Need to differentiate between nullptr (unset) and type mismatch

Bug: 1294817, b/221918704
Change-Id: I064ae9c05899dad91f4c068407292d4ac0f33a1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546396
Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Reviewed-by: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Igor Ruvinov <igorruvinov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#984827}
2022-03-24 15:02:14 +00:00
80fc813ee1 Migrate remaining odd callers of base::PostTask/Create*TaskRunner in /components/proxy_config
Most callers were already migrated via scripts, this is a split
of the remaining callers or comment-references that weren't caught
by those scripts.

@QA: This CL is a logical no-op.

This CL was uploaded by git cl split.

R=pmarko@chromium.org

Bug: 1026641
Change-Id: I07cd5353babf6ba9326a740422ba41a207306768
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3529750
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#982770}
2022-03-18 17:31:22 +00:00
88b2443b34 Add missing includes of //base/observer_list.h
Bug: 1290552
Change-Id: I232c1c991e45de275f7c652b1ea191c6f096a559
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3492976
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975612}
2022-02-28 01:10:02 +00:00
7b7aaecca4 Migrate base::{size,empty,data} to STL equivalents in //components.
Bug: 1299695
Change-Id: Ia2ef2239d649b2a50569cad9b3f293ca23510b68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3491962
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975484}
2022-02-26 17:57:25 +00:00
7d219a2536 [Code Health] Refactor PrefService GetDict + GetList to use base::Value
LSC doc: go/prefservice-value-refactor

All type  changes are commented.

Bug: 1187001, 1187061, 1187062
Change-Id: Iafefe56f769b7cb4a05ed4afbfb6e9a561b4704a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3343526
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Owners-Override: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#952919}
2021-12-20 14:55:31 +00:00
21f256b202 CodeHealth: Remove DictionaryValue::Get in components/
Bug: 1187032
Change-Id: I1a2a9a3a0b2ff13d0764a7decc0b85166859d3f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3325882
Auto-Submit: Li-Yu Yu <aaronyu@google.com>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Li-Yu Yu <aaronyu@google.com>
Cr-Commit-Position: refs/heads/main@{#950531}
2021-12-10 14:41:59 +00:00
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
b9e2c27ca6 Remove unused "base/macros.h" in components/
Removes `#include "base/macros.h"` from files in components/ that do not
contain `ignore_result(`.

Bug: 1010217
Change-Id: Ic1ea0c59d63652bc896e80638a7ff919c872f1c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3275012
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940666}
2021-11-11 05:31:49 +00:00
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
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
9f667c3873 Remove DISALLOW_* macros from components/
This inlines all remaining DISALLOW_* macros in components/. This is
done manually (vim regex + manually finding insertion position).

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

Bug: 1010217
Change-Id: I2409b6250d85e74e8c4b6863fbeeaaeacc37733c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3194821
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927361}
2021-10-01 20:09:31 +00:00
5ccc3f0d4f Split ProxyServer PAC/URI conversion to a separate file
No functional change.

Helps simplify the ProxyServer class around its core purpose of
representing proxy servers for net stack connections, which will
make it easier to make upcoming refactors to both that and the
separated-off conversion functionality.

Bug: 1243398
Change-Id: I476656b709a3ed9d188244e36f8db8eb40755414
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3138601
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Andreea-Elena Costinas <acostinas@google.com>
Reviewed-by: Robert Ogden <robertogden@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Eric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/main@{#924111}
2021-09-23 00:01:57 +00:00