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

Side by Side Diff: net/http/http_content_disposition.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/http/http_chunked_decoder_unittest.cc ('k') | net/http/http_content_disposition.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP_HTTP_CONTENT_DISPOSITION_H_
6 #define NET_HTTP_HTTP_CONTENT_DISPOSITION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "net/base/net_export.h"
12
13 namespace net {
14
15 class NET_EXPORT HttpContentDisposition {
16 public:
17 enum Type {
18 INLINE,
19 ATTACHMENT,
20 };
21
22 // Properties of the Content-Disposition header. Used for UMA.
23 enum ParseResultFlags {
24 INVALID = 0,
25
26 // A valid disposition-type is present.
27 HAS_DISPOSITION_TYPE = 1 << 0,
28
29 // The disposition-type is not 'inline' or 'attachment'.
30 HAS_UNKNOWN_DISPOSITION_TYPE = 1 << 1,
31
32 // Has a valid non-empty 'name' attribute.
33 HAS_NAME = 1 << 2,
34
35 // Has a valid non-empty 'filename' attribute.
36 HAS_FILENAME = 1 << 3,
37
38 // Has a valid non-empty 'filename*' attribute.
39 HAS_EXT_FILENAME = 1 << 4,
40
41 // The following fields are properties of the 'filename' attribute:
42
43 // Quoted-string contains non-ASCII characters.
44 HAS_NON_ASCII_STRINGS = 1 << 5,
45
46 // Quoted-string contains percent-encoding.
47 HAS_PERCENT_ENCODED_STRINGS = 1 << 6,
48
49 // Quoted-string contains RFC 2047 encoded words.
50 HAS_RFC2047_ENCODED_STRINGS = 1 << 7
51 };
52
53 HttpContentDisposition(const std::string& header,
54 const std::string& referrer_charset);
55 ~HttpContentDisposition();
56
57 bool is_attachment() const { return type() == ATTACHMENT; }
58
59 Type type() const { return type_; }
60 const std::string& filename() const { return filename_; }
61
62 // A combination of ParseResultFlags values.
63 int parse_result_flags() const { return parse_result_flags_; }
64
65 private:
66 void Parse(const std::string& header, const std::string& referrer_charset);
67 std::string::const_iterator ConsumeDispositionType(
68 std::string::const_iterator begin, std::string::const_iterator end);
69
70 Type type_;
71 std::string filename_;
72 int parse_result_flags_;
73
74 DISALLOW_COPY_AND_ASSIGN(HttpContentDisposition);
75 };
76
77 } // namespace net
78
79 #endif // NET_HTTP_HTTP_CONTENT_DISPOSITION_H_
OLDNEW
« no previous file with comments | « net/http/http_chunked_decoder_unittest.cc ('k') | net/http/http_content_disposition.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698