There are several conceptual layers in this directory. Going from the lowest level up, they are:
The url_parse.*
files are the parser. This code does no string transformations. Its only job is to take an input string and split out the components of the URL as best as it can deduce them, for a given type of URL. Parsing can never fail, it will take its best guess. This layer does not have logic for determining the type of URL parsing to apply, that needs to be applied at a higher layer (the “util” layer below).
Because the parser code is derived (very distantly) from some code in Mozilla, some of the parser files are in url/third_party/mozilla/
.
The main header to include for calling the parser is url/third_party/mozilla/url_parse.h
.
The url_canon*
files are the canonicalizer. This code will transform specific URL components or specific types of URLs into a standard form. For some dangerous or invalid data, the canonicalizer will report that a URL is invalid, although it will always try its best to produce output (so the calling code can, for example, show the user an error that the URL is invalid). The canonicalizer attempts to provide as consistent a representation as possible without changing the meaning of a URL.
The canonicalizer layer is designed to be independent of the string type of the embedder, so all string output is done through a CanonOutput
wrapper object. An implementation for std::string
output is provided in url_canon_stdstring.h
.
The main header to include for calling the canonicalizer is url/url_canon.h
.
The url_util*
files provide a higher-level wrapper around the parser and canonicalizer. While it can be called directly, it is designed to be the foundation for writing URL wrapper objects (The GURL later and Blink's KURL object use the Utility layer to implement the low-level logic).
The Utility code makes decisions about URL types and calls the correct parsing and canonicalzation functions for those types. It provides an interface to register application-specific schemes that have specific requirements. Sharing this loigic between KURL and GURL is important so that URLs are handled consistently across the application.
The main header to include is url/url_util.h
.
At the highest layer, a C++ object for representing URLs is provided. This object uses STL. Most uses need only this layer. Include url/gurl.h
.
Also at this layer is also the Origin object which exists to make security decisions on the web. Include url/origin.h
.
This code was originally a separate library that was designed to be embedded into both Chrome (which uses STL) and WebKit (which didn't use any STL at the time). As a result, the parsing, canonicalization, and utility code could not use STL, or any other common code in Chromium like base.
When WebKit was forked into the Chromium repo and renamed Blink, this restriction has been relaxed somewhat. Blink still provides its own URL object using its own string type, so the insulation that the Utility layer provides is still useful. But some STL strings and calls to base functions have gradually been added in places where doing so is possible.
Due to historical usage, the term “Standard URL” is currently used within the code to represent “Special URLs”, except for “file:” scheme URL, as defined in the URL Standard. However, this terminology is outdated and can lead to confusion, particularly now that we are supporting non-special URLs as well (crbug/1416006). For the sake of consistency and clarity, it is recommended to switch to the more accurate term “Special URL” throughout the codebase. However, this change should be carefully planned and executed due to the widespread use of the current terminology in both internal and third-party code. For a while, “Standard URL” and “Special URL” are used interchangeably.
维生素b6主治什么病 | 胆汁是由什么分泌的 | 送葬后回家注意什么 | 5月22是什么星座 | 什么样的牙齿需要矫正 |
浪人是什么意思 | 送命题是什么意思 | 无机磷偏低有什么影响 | 股癣是什么原因引起的 | 网飞是什么 |
肾功能不全是什么意思 | 急火攻心是什么生肖 | hb什么意思 | 什么的头发 | 飞机上什么东西不能带 |
白巧克力是什么做的 | 为什么一直流鼻涕 | 121什么意思 | 甲状腺3类是什么意思 | 阳历6月28日是什么星座 |
非淋菌性尿道炎吃什么药最好hcv9jop5ns4r.cn | bq是什么意思啊hcv7jop6ns0r.cn | 眼压高是什么意思0297y7.com | 89年的属什么hcv7jop7ns2r.cn | rh血型阳性是什么意思baiqunet.com |
1月10日什么星座hcv9jop7ns9r.cn | 身体出汗多是什么原因hcv9jop4ns4r.cn | 吃什么助消化hcv7jop6ns2r.cn | 女生左手食指戴戒指什么意思hcv8jop4ns1r.cn | 亲子鉴定需要什么样本wmyky.com |
空调用什么插座hcv9jop3ns4r.cn | 午时银花露有什么功效hcv8jop2ns4r.cn | 口红什么牌子最好hcv8jop7ns7r.cn | 日本艺伎是干什么的hcv8jop6ns4r.cn | 什么是精神出轨cl108k.com |
上学是为了什么hcv8jop8ns0r.cn | 肚子疼吐了是什么原因hcv8jop1ns0r.cn | 未必是什么意思hcv8jop8ns0r.cn | 甲醛什么气味yanzhenzixun.com | 农历11月14日是什么星座hcv9jop8ns1r.cn |