Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / net / base / escape.h
index 69eb2a5..1915d24 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "base/basictypes.h"
 #include "base/strings/string16.h"
+#include "base/strings/utf_offset_string_conversions.h"
 #include "net/base/net_export.h"
 
 namespace net {
@@ -114,42 +115,21 @@ NET_EXPORT base::string16 UnescapeURLComponent(
 // Unescapes the given substring as a URL, and then tries to interpret the
 // result as being encoded as UTF-8. If the result is convertable into UTF-8, it
 // will be returned as converted. If it is not, the original escaped string will
-// be converted into a base::string16 and returned. (|offset[s]_for_adjustment|)
-// specifies one or more offsets into the source strings; each offset will be
-// adjusted to point at the same logical place in the result strings during
-// decoding.  If this isn't possible because an offset points past the end of
-// the source strings or into the middle of a multibyte sequence, the offending
-// offset will be set to string16::npos. |offset[s]_for_adjustment| may be NULL.
+// be converted into a base::string16 and returned.  |adjustments| provides
+// information on how the original string was adjusted to get the string
+// returned.
 NET_EXPORT base::string16 UnescapeAndDecodeUTF8URLComponent(
     const std::string& text,
-    UnescapeRule::Type rules,
-    size_t* offset_for_adjustment);
-NET_EXPORT base::string16 UnescapeAndDecodeUTF8URLComponentWithOffsets(
+    UnescapeRule::Type rules);
+NET_EXPORT base::string16 UnescapeAndDecodeUTF8URLComponentWithAdjustments(
     const std::string& text,
     UnescapeRule::Type rules,
-    std::vector<size_t>* offsets_for_adjustment);
+    base::OffsetAdjuster::Adjustments* adjustments);
 
 // Unescapes the following ampersand character codes from |text|:
 // &lt; &gt; &amp; &quot; &#39;
 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text);
 
-namespace internal {
-
-// Private Functions (Exposed for Unit Testing) --------------------------------
-
-// A function called by std::for_each that will adjust any offset which occurs
-// after one or more encoded characters.
-struct NET_EXPORT_PRIVATE AdjustEncodingOffset {
-  typedef std::vector<size_t> Adjustments;
-
-  explicit AdjustEncodingOffset(const Adjustments& adjustments);
-  void operator()(size_t& offset);
-
-  const Adjustments& adjustments;
-};
-
-}  // namespace internal
-
 }  // namespace net
 
 #endif  // NET_BASE_ESCAPE_H_