Name Date Size #Lines LOC

..--

android/H25-Apr-2025-2,0191,433

ipc/H25-Apr-2025-321221

mojom/H25-Apr-2025-689501

third_party/mozilla/H25-Apr-2025-1,7921,073

Android.bpH A D25-Apr-202517.9 KiB472466

BUILD.gnH A D25-Apr-202510 KiB398360

DEPSH A D25-Apr-2025385 2018

DIR_METADATAH A D25-Apr-202589 76

README.mdH A D25-Apr-20254.1 KiB9268

features.gniH A D25-Apr-2025699 1714

gurl.ccH A D25-Apr-202517.3 KiB583429

gurl.hH A D25-Apr-202522.4 KiB548201

gurl_abstract_tests.hH A D25-Apr-20255.2 KiB12085

gurl_fuzzer.ccH A D25-Apr-20253.1 KiB9068

gurl_fuzzer.dictH A D25-Apr-20253.8 KiB433428

gurl_unittest.ccH A D25-Apr-202553.6 KiB1,5001,157

origin.ccH A D25-Apr-202516 KiB501332

origin.hH A D25-Apr-202521 KiB511188

origin_abstract_tests.ccH A D25-Apr-20253 KiB10567

origin_abstract_tests.hH A D25-Apr-202523.9 KiB621435

origin_unittest.ccH A D25-Apr-202536.7 KiB912680

run_all_perftests.ccH A D25-Apr-2025486 159

run_all_unittests.ccH A D25-Apr-2025698 2818

scheme_host_port.ccH A D25-Apr-20259.8 KiB319216

scheme_host_port.hH A D25-Apr-20257.1 KiB18250

scheme_host_port_unittest.ccH A D25-Apr-202510.9 KiB300247

url_canon.ccH A D25-Apr-2025416 167

url_canon.hH A D25-Apr-202548.3 KiB1,181663

url_canon_etc.ccH A D25-Apr-202516.7 KiB429290

url_canon_filesystemurl.ccH A D25-Apr-20255.2 KiB13298

url_canon_fileurl.ccH A D25-Apr-20259 KiB251168

url_canon_host.ccH A D25-Apr-202526.5 KiB698466

url_canon_icu.ccH A D25-Apr-20253.9 KiB11577

url_canon_icu.hH A D25-Apr-20251.2 KiB4220

url_canon_icu_fuzzer.ccH A D25-Apr-2025678 2616

url_canon_icu_test_helpers.hH A D25-Apr-20251 KiB4227

url_canon_icu_unittest.ccH A D25-Apr-20254.6 KiB146105

url_canon_internal.ccH A D25-Apr-202520.9 KiB502398

url_canon_internal.hH A D25-Apr-202520 KiB481233

url_canon_internal_file.hH A D25-Apr-20255.5 KiB13666

url_canon_ip.ccH A D25-Apr-202524.3 KiB705415

url_canon_ip.hH A D25-Apr-20252.3 KiB6130

url_canon_mailtourl.ccH A D25-Apr-20254.5 KiB12892

url_canon_non_special_url.ccH A D25-Apr-20259.4 KiB254137

url_canon_path.ccH A D25-Apr-202517.6 KiB406234

url_canon_pathurl.ccH A D25-Apr-20255.6 KiB146101

url_canon_query.ccH A D25-Apr-20256 KiB15085

url_canon_relative.ccH A D25-Apr-202529.2 KiB715409

url_canon_stdstring.ccH A D25-Apr-2025766 3119

url_canon_stdstring.hH A D25-Apr-20254.8 KiB13374

url_canon_stdurl.ccH A D25-Apr-20257.8 KiB210148

url_canon_unittest.ccH A D25-Apr-2025139.6 KiB3,2962,428

url_constants.hH A D25-Apr-20252.9 KiB7053

url_features.ccH A D25-Apr-20251.7 KiB5131

url_features.hH A D25-Apr-20251.3 KiB3813

url_file.hH A D25-Apr-20253.9 KiB10462

url_idna_icu.ccH A D25-Apr-20255.3 KiB14769

url_idna_icu_alternatives_android.ccH A D25-Apr-20251.2 KiB4024

url_idna_icu_alternatives_ios.mmH A D25-Apr-2025722 2922

url_idna_icu_fuzzer.ccH A D25-Apr-2025742 3220

url_parse_file.ccH A D25-Apr-20257.8 KiB19996

url_parse_internal.hH A D25-Apr-20255 KiB12772

url_parse_perftest.ccH A D25-Apr-20254.6 KiB137109

url_parse_unittest.ccH A D25-Apr-202536.9 KiB743527

url_test_utils.hH A D25-Apr-20251.1 KiB4019

url_util.ccH A D25-Apr-202536.4 KiB967688

url_util.hH A D25-Apr-202514.4 KiB333153

url_util_internal.hH A D25-Apr-2025757 2412

url_util_unittest.ccH A D25-Apr-202533.6 KiB901680

README.md

1# Chrome's URL library
2
3## Layers
4
5There are several conceptual layers in this directory. Going from the lowest
6level up, they are:
7
8### Parsing
9
10The `url_parse.*` files are the parser. This code does no string
11transformations. Its only job is to take an input string and split out the
12components of the URL as best as it can deduce them, for a given type of URL.
13Parsing can never fail, it will take its best guess. This layer does not
14have logic for determining the type of URL parsing to apply, that needs to
15be applied at a higher layer (the "util" layer below).
16
17Because the parser code is derived (_very_ distantly) from some code in
18Mozilla, some of the parser files are in `url/third_party/mozilla/`.
19
20The main header to include for calling the parser is
21`url/third_party/mozilla/url_parse.h`.
22
23### Canonicalization
24
25The `url_canon*` files are the canonicalizer. This code will transform specific
26URL components or specific types of URLs into a standard form. For some
27dangerous or invalid data, the canonicalizer will report that a URL is invalid,
28although it will always try its best to produce output (so the calling code
29can, for example, show the user an error that the URL is invalid). The
30canonicalizer attempts to provide as consistent a representation as possible
31without changing the meaning of a URL.
32
33The canonicalizer layer is designed to be independent of the string type of
34the embedder, so all string output is done through a `CanonOutput` wrapper
35object. An implementation for `std::string` output is provided in
36`url_canon_stdstring.h`.
37
38The main header to include for calling the canonicalizer is
39`url/url_canon.h`.
40
41### Utility
42
43The `url_util*` files provide a higher-level wrapper around the parser and
44canonicalizer. While it can be called directly, it is designed to be the
45foundation for writing URL wrapper objects (The GURL later and Blink's KURL
46object use the Utility layer to implement the low-level logic).
47
48The Utility code makes decisions about URL types and calls the correct parsing
49and canonicalzation functions for those types. It provides an interface to
50register application-specific schemes that have specific requirements.
51Sharing this loigic between KURL and GURL is important so that URLs are
52handled consistently across the application.
53
54The main header to include is `url/url_util.h`.
55
56### Google URL (GURL) and Origin
57
58At the highest layer, a C++ object for representing URLs is provided. This
59object uses STL. Most uses need only this layer. Include `url/gurl.h`.
60
61Also at this layer is also the Origin object which exists to make security
62decisions on the web. Include `url/origin.h`.
63
64## Historical background
65
66This code was originally a separate library that was designed to be embedded
67into both Chrome (which uses STL) and WebKit (which didn't use any STL at the
68time). As a result, the parsing, canonicalization, and utility code could
69not use STL, or any other common code in Chromium like base.
70
71When WebKit was forked into the Chromium repo and renamed Blink, this
72restriction has been relaxed somewhat. Blink still provides its own URL object
73using its own string type, so the insulation that the Utility layer provides is
74still useful. But some STL strings and calls to base functions have gradually
75been added in places where doing so is possible.
76
77## Caution for terminologies
78
79Due to historical usage, the term "Standard URL" is currently used within the
80code to represent "[Special URLs][1]", except for "file:" scheme URL, as defined
81in the URL Standard. However, this terminology is outdated and can lead to
82confusion, particularly now that we are supporting [non-special URLs][2] as well
83([crbug/1416006][3]). For the sake of consistency and clarity, it is recommended
84to switch to the more accurate term "Special URL" throughout the codebase.
85However, this change should be carefully planned and executed due to the
86widespread use of the current terminology in both internal and third-party code.
87For a while, "Standard URL" and "Special URL" are used interchangeably.
88
89[1]: https://url.spec.whatwg.org/#is-special
90[2]: https://url.spec.whatwg.org/#is-not-special
91[3]: https://crbug.com/1416006
92