move SK_DISABLE_DITHER_32BIT_GRADIENT from SkUserConfig.h to skia.gyp, so we can...
[chromium-blink-merge.git] / net / base / data_url.h
blob3c1e3033dc6fa2c3368fa24a98af13fee601aab0
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_BASE_DATA_URL_H_
6 #define NET_BASE_DATA_URL_H_
8 #include <string>
10 #include "net/base/net_export.h"
12 class GURL;
14 namespace net {
16 // See RFC 2397 for a complete description of the 'data' URL scheme.
18 // Briefly, a 'data' URL has the form:
20 // data:[<mediatype>][;base64],<data>
22 // The <mediatype> is an Internet media type specification (with optional
23 // parameters.) The appearance of ";base64" means that the data is encoded as
24 // base64. Without ";base64", the data (as a sequence of octets) is represented
25 // using ASCII encoding for octets inside the range of safe URL characters and
26 // using the standard %xx hex encoding of URLs for octets outside that range.
27 // If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a
28 // shorthand, "text/plain" can be omitted but the charset parameter supplied.
30 class NET_EXPORT DataURL {
31 public:
32 // This method can be used to parse a 'data' URL into its component pieces.
34 // The resulting mime_type is normalized to lowercase. The data is the
35 // decoded data (e.g.., if the data URL specifies base64 encoding, then the
36 // returned data is base64 decoded, and any %-escaped bytes are unescaped).
38 // If the URL is malformed, then this method will return false, and its
39 // output variables will remain unchanged. On success, true is returned.
41 // OPTIONAL: If |data| is NULL, then the <data> section will not be parsed
42 // or validated.
44 static bool Parse(const GURL& url,
45 std::string* mime_type,
46 std::string* charset,
47 std::string* data);
50 } // namespace net
52 #endif // NET_BASE_DATA_URL_H_