diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-17 00:16:54 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-17 00:16:54 +0000 |
commit | a7206e77788f434a825828b804bf6446d797f8a8 (patch) | |
tree | f0ac52f8e41cbca071cdac1ed70bf0a8c38dc33b /net/http/http_content_disposition.h | |
parent | b3dbcb5e2445baec0ceca5e57de9bf07621679ab (diff) | |
download | chromium_src-a7206e77788f434a825828b804bf6446d797f8a8.zip chromium_src-a7206e77788f434a825828b804bf6446d797f8a8.tar.gz chromium_src-a7206e77788f434a825828b804bf6446d797f8a8.tar.bz2 |
Add UMA for measuring Content-Dispostion header use and abuse.
BUG=162815
Review URL: https://chromiumcodereview.appspot.com/11478034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_content_disposition.h')
-rw-r--r-- | net/http/http_content_disposition.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/net/http/http_content_disposition.h b/net/http/http_content_disposition.h index f3573a9..2b4ca70 100644 --- a/net/http/http_content_disposition.h +++ b/net/http/http_content_disposition.h @@ -19,6 +19,37 @@ class NET_EXPORT HttpContentDisposition { ATTACHMENT, }; + // Properties of the Content-Disposition header. Used for UMA. + enum ParseResultFlags { + INVALID = 0, + + // A valid disposition-type is present. + HAS_DISPOSITION_TYPE = 1 << 0, + + // The disposition-type is not 'inline' or 'attachment'. + HAS_UNKNOWN_DISPOSITION_TYPE = 1 << 1, + + // Has a valid non-empty 'name' attribute. + HAS_NAME = 1 << 2, + + // Has a valid non-empty 'filename' attribute. + HAS_FILENAME = 1 << 3, + + // Has a valid non-empty 'filename*' attribute. + HAS_EXT_FILENAME = 1 << 4, + + // The following fields are properties of the 'filename' attribute: + + // Quoted-string contains non-ASCII characters. + HAS_NON_ASCII_STRINGS = 1 << 5, + + // Quoted-string contains percent-encoding. + HAS_PERCENT_ENCODED_STRINGS = 1 << 6, + + // Quoted-string contains RFC 2047 encoded words. + HAS_RFC2047_ENCODED_STRINGS = 1 << 7 + }; + HttpContentDisposition(const std::string& header, const std::string& referrer_charset); ~HttpContentDisposition(); @@ -28,6 +59,9 @@ class NET_EXPORT HttpContentDisposition { Type type() const { return type_; } const std::string& filename() const { return filename_; } + // A combination of ParseResultFlags values. + int parse_result_flags() const { return parse_result_flags_; } + private: void Parse(const std::string& header, const std::string& referrer_charset); std::string::const_iterator ConsumeDispositionType( @@ -35,6 +69,7 @@ class NET_EXPORT HttpContentDisposition { Type type_; std::string filename_; + int parse_result_flags_; DISALLOW_COPY_AND_ASSIGN(HttpContentDisposition); }; |