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

Side by Side Diff: third_party/WebKit/Source/core/dom/URLSearchParams.h

Issue 2725593003: Construct URLSearchParams from sequence initializer. (Closed)
Patch Set: style update Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef URLSearchParams_h 5 #ifndef URLSearchParams_h
6 #define URLSearchParams_h 6 #define URLSearchParams_h
7 7
8 #include <base/gtest_prod_util.h>
9 #include <utility>
8 #include "bindings/core/v8/Iterable.h" 10 #include "bindings/core/v8/Iterable.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 11 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/core/v8/USVStringOrURLSearchParams.h" 12 #include "bindings/core/v8/USVStringSequenceSequenceOrUSVStringOrURLSearchParams .h"
11 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
12 #include "platform/network/EncodedFormData.h" 14 #include "platform/network/EncodedFormData.h"
13 #include "wtf/Forward.h" 15 #include "wtf/Forward.h"
14 #include "wtf/text/WTFString.h" 16 #include "wtf/text/WTFString.h"
15 #include <base/gtest_prod_util.h>
16 #include <utility>
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class ExceptionState; 20 class ExceptionState;
21 class DOMURL; 21 class DOMURL;
22 22
23 typedef USVStringOrURLSearchParams URLSearchParamsInit; 23 typedef USVStringSequenceSequenceOrUSVStringOrURLSearchParams
24 URLSearchParamsInit;
24 25
25 class CORE_EXPORT URLSearchParams final 26 class CORE_EXPORT URLSearchParams final
26 : public GarbageCollectedFinalized<URLSearchParams>, 27 : public GarbageCollectedFinalized<URLSearchParams>,
27 public ScriptWrappable, 28 public ScriptWrappable,
28 public PairIterable<String, String> { 29 public PairIterable<String, String> {
29 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
30 31
31 public: 32 public:
32 static URLSearchParams* create(const URLSearchParamsInit&); 33 static URLSearchParams* create(const URLSearchParamsInit&, ExceptionState&);
34 static URLSearchParams* create(const Vector<Vector<String>>&,
35 ExceptionState&);
33 36
34 static URLSearchParams* create(const String& queryString, 37 static URLSearchParams* create(const String& queryString,
35 DOMURL* urlObject = nullptr) { 38 DOMURL* urlObject = nullptr) {
36 return new URLSearchParams(queryString, urlObject); 39 return new URLSearchParams(queryString, urlObject);
37 } 40 }
38 41
39 ~URLSearchParams(); 42 ~URLSearchParams();
40 43
41 // URLSearchParams interface methods 44 // URLSearchParams interface methods
42 String toString() const; 45 String toString() const;
(...skipping 18 matching lines...) Expand all
61 private: 64 private:
62 FRIEND_TEST_ALL_PREFIXES(URLSearchParamsTest, EncodedFormData); 65 FRIEND_TEST_ALL_PREFIXES(URLSearchParamsTest, EncodedFormData);
63 66
64 explicit URLSearchParams(const String&, DOMURL* = nullptr); 67 explicit URLSearchParams(const String&, DOMURL* = nullptr);
65 explicit URLSearchParams(URLSearchParams*); 68 explicit URLSearchParams(URLSearchParams*);
66 69
67 void runUpdateSteps(); 70 void runUpdateSteps();
68 IterationSource* startIteration(ScriptState*, ExceptionState&) override; 71 IterationSource* startIteration(ScriptState*, ExceptionState&) override;
69 void encodeAsFormData(Vector<char>&) const; 72 void encodeAsFormData(Vector<char>&) const;
70 73
74 void appendWithoutUpdate(const String& name, const String& value);
75
71 Vector<std::pair<String, String>> m_params; 76 Vector<std::pair<String, String>> m_params;
72 77
73 WeakMember<DOMURL> m_urlObject; 78 WeakMember<DOMURL> m_urlObject;
74 }; 79 };
75 80
76 } // namespace blink 81 } // namespace blink
77 82
78 #endif // URLSearchParams_h 83 #endif // URLSearchParams_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698