Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: net/base/net_util.h

Issue 23619016: Switch the offset conversion routines from... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 // Creates a string representation of |url|. The IDN host name may be in Unicode 364 // Creates a string representation of |url|. The IDN host name may be in Unicode
365 // if |languages| accepts the Unicode representation. |format_type| is a bitmask 365 // if |languages| accepts the Unicode representation. |format_type| is a bitmask
366 // of FormatUrlTypes, see it for details. |unescape_rules| defines how to clean 366 // of FormatUrlTypes, see it for details. |unescape_rules| defines how to clean
367 // the URL for human readability. You will generally want |UnescapeRule::SPACES| 367 // the URL for human readability. You will generally want |UnescapeRule::SPACES|
368 // for display to the user if you can handle spaces, or |UnescapeRule::NORMAL| 368 // for display to the user if you can handle spaces, or |UnescapeRule::NORMAL|
369 // if not. If the path part and the query part seem to be encoded in %-encoded 369 // if not. If the path part and the query part seem to be encoded in %-encoded
370 // UTF-8, decodes %-encoding and UTF-8. 370 // UTF-8, decodes %-encoding and UTF-8.
371 // 371 //
372 // The last three parameters may be NULL. 372 // The last three parameters may be NULL.
373 //
373 // |new_parsed| will be set to the parsing parameters of the resultant URL. 374 // |new_parsed| will be set to the parsing parameters of the resultant URL.
375 //
374 // |prefix_end| will be the length before the hostname of the resultant URL. 376 // |prefix_end| will be the length before the hostname of the resultant URL.
375 // 377 //
376 // (|offset[s]_for_adjustment|) specifies one or more offsets into the original 378 // |offset[s]_for_adjustment| specifies one or more offsets into the original
377 // |url|'s spec(); each offset will be modified to reflect changes this function 379 // URL, representing insertion or selection points between characters: if the
378 // makes to the output string. For example, if |url| is "http://a:b@c.com/", 380 // input is "http://foo.com/", offset 0 is before the entire URL, offset 7 is
379 // |omit_username_password| is true, and an offset is 12 (the offset of '.'), 381 // between the scheme and the host, and offset 15 is after the end of the URL.
380 // then on return the output string will be "http://c.com/" and the offset will 382 // Valid input offsets range from 0 to the length of the input URL string. On
381 // be 8. If an offset cannot be successfully adjusted (e.g. because it points 383 // exit, each offset will have been modified to reflect any changes made to the
382 // into the middle of a component that was entirely removed, past the end of the 384 // output string. For example, if |url| is "http://a:b@c.com/",
383 // string, or into the middle of an encoding sequence), it will be set to 385 // |omit_username_password| is true, and an offset is 12 (pointing between 'c'
384 // base::string16::npos. 386 // and '.'), then on return the output string will be "http://c.com/" and the
387 // offset will be 8. If an offset cannot be successfully adjusted (e.g. because
388 // it points into the middle of a component that was entirely removed or into
389 // the middle of an encoding sequence), it will be set to base::string16::npos.
390 // For consistency, if an input offset points between the scheme and the
391 // username/password, and both are removed, on output this offset will be 0
392 // rather than npos; this means that offsets at the starts and ends of removed
393 // components are always transformed the same way regardless of what other
394 // components are adjacent.
385 NET_EXPORT base::string16 FormatUrl(const GURL& url, 395 NET_EXPORT base::string16 FormatUrl(const GURL& url,
386 const std::string& languages, 396 const std::string& languages,
387 FormatUrlTypes format_types, 397 FormatUrlTypes format_types,
388 UnescapeRule::Type unescape_rules, 398 UnescapeRule::Type unescape_rules,
389 url_parse::Parsed* new_parsed, 399 url_parse::Parsed* new_parsed,
390 size_t* prefix_end, 400 size_t* prefix_end,
391 size_t* offset_for_adjustment); 401 size_t* offset_for_adjustment);
392 NET_EXPORT base::string16 FormatUrlWithOffsets( 402 NET_EXPORT base::string16 FormatUrlWithOffsets(
393 const GURL& url, 403 const GURL& url,
394 const std::string& languages, 404 const std::string& languages,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN 549 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN
540 }; 550 };
541 551
542 // Characterize the PHY mode of the currently associated access point. 552 // Characterize the PHY mode of the currently associated access point.
543 // Currently only available on OS_WIN. 553 // Currently only available on OS_WIN.
544 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); 554 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol();
545 555
546 } // namespace net 556 } // namespace net
547 557
548 #endif // NET_BASE_NET_UTIL_H_ 558 #endif // NET_BASE_NET_UTIL_H_
OLDNEW
« no previous file with comments | « net/base/escape_unittest.cc ('k') | net/base/net_util.cc » ('j') | net/base/net_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698