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

Side by Side Diff: third_party/WebKit/Source/platform/network/ParsedContentDisposition.h

Issue 2880543003: Implement a parser for Content-Disposition header fields (Closed)
Patch Set: Rebase Created 3 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2017 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 ParsedContentDisposition_h
6 #define ParsedContentDisposition_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/network/ParsedContentHeaderFieldParameters.h"
10 #include "platform/wtf/Allocator.h"
11 #include "platform/wtf/HashMap.h"
12 #include "platform/wtf/text/StringHash.h"
13
14 namespace blink {
15
16 // Parses the content of a Content-Disposition header field into disposition
17 // type and parameters and stores them.
18 class PLATFORM_EXPORT ParsedContentDisposition final {
19 STACK_ALLOCATED();
20
21 public:
22 using Mode = ParsedContentHeaderFieldParameters::Mode;
23
24 explicit ParsedContentDisposition(const String&, Mode = Mode::kNormal);
25
26 String Type() const { return type_; }
27 String Filename() const;
28
29 // Note that in the case of multiple values for the same name, the last value
30 // is returned.
31 String ParameterValueForName(const String& name) const {
32 return parameters_.ParameterValueForName(name);
33 }
34 size_t ParameterCount() const { return parameters_.ParameterCount(); }
35
36 bool IsValid() const { return parameters_.IsValid(); }
37
38 private:
39 String type_;
40 ParsedContentHeaderFieldParameters parameters_;
41 };
42
43 } // namespace blink
44
45 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698