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

Side by Side Diff: Source/core/loader/FormSubmission.cpp

Issue 123003002: Make calls to AtomicString(const String&) explicit in loader/ and fetch/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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 | « Source/core/loader/FormSubmission.h ('k') | Source/core/loader/FrameFetchContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 query.append(body); 79 query.append(body);
80 url.setQuery(query); 80 url.setQuery(query);
81 } 81 }
82 82
83 void FormSubmission::Attributes::parseAction(const String& action) 83 void FormSubmission::Attributes::parseAction(const String& action)
84 { 84 {
85 // FIXME: Can we parse into a KURL? 85 // FIXME: Can we parse into a KURL?
86 m_action = stripLeadingAndTrailingHTMLSpaces(action); 86 m_action = stripLeadingAndTrailingHTMLSpaces(action);
87 } 87 }
88 88
89 String FormSubmission::Attributes::parseEncodingType(const String& type) 89 AtomicString FormSubmission::Attributes::parseEncodingType(const String& type)
90 { 90 {
91 if (equalIgnoringCase(type, "multipart/form-data")) 91 if (equalIgnoringCase(type, "multipart/form-data"))
92 return "multipart/form-data"; 92 return AtomicString("multipart/form-data", AtomicString::ConstructFromLi teral);
93 if (equalIgnoringCase(type, "text/plain")) 93 if (equalIgnoringCase(type, "text/plain"))
94 return "text/plain"; 94 return AtomicString("text/plain", AtomicString::ConstructFromLiteral);
95 return "application/x-www-form-urlencoded"; 95 return AtomicString("application/x-www-form-urlencoded", AtomicString::Const ructFromLiteral);
96 } 96 }
97 97
98 void FormSubmission::Attributes::updateEncodingType(const String& type) 98 void FormSubmission::Attributes::updateEncodingType(const String& type)
99 { 99 {
100 m_encodingType = parseEncodingType(type); 100 m_encodingType = parseEncodingType(type);
101 m_isMultiPartForm = (m_encodingType == "multipart/form-data"); 101 m_isMultiPartForm = (m_encodingType == "multipart/form-data");
102 } 102 }
103 103
104 FormSubmission::Method FormSubmission::Attributes::parseMethodType(const String& type) 104 FormSubmission::Method FormSubmission::Attributes::parseMethodType(const String& type)
105 { 105 {
(...skipping 27 matching lines...) Expand all
133 { 133 {
134 m_method = other.m_method; 134 m_method = other.m_method;
135 m_isMultiPartForm = other.m_isMultiPartForm; 135 m_isMultiPartForm = other.m_isMultiPartForm;
136 136
137 m_action = other.m_action; 137 m_action = other.m_action;
138 m_target = other.m_target; 138 m_target = other.m_target;
139 m_encodingType = other.m_encodingType; 139 m_encodingType = other.m_encodingType;
140 m_acceptCharset = other.m_acceptCharset; 140 m_acceptCharset = other.m_acceptCharset;
141 } 141 }
142 142
143 inline FormSubmission::FormSubmission(Method method, const KURL& action, const A tomicString& target, const String& contentType, PassRefPtr<FormState> state, Pas sRefPtr<FormData> data, const String& boundary, PassRefPtr<Event> event) 143 inline FormSubmission::FormSubmission(Method method, const KURL& action, const A tomicString& target, const AtomicString& contentType, PassRefPtr<FormState> stat e, PassRefPtr<FormData> data, const String& boundary, PassRefPtr<Event> event)
144 : m_method(method) 144 : m_method(method)
145 , m_action(action) 145 , m_action(action)
146 , m_target(target) 146 , m_target(target)
147 , m_contentType(contentType) 147 , m_contentType(contentType)
148 , m_formState(state) 148 , m_formState(state)
149 , m_formData(data) 149 , m_formData(data)
150 , m_boundary(boundary) 150 , m_boundary(boundary)
151 , m_event(event) 151 , m_event(event)
152 { 152 {
153 } 153 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 copiedAttributes.setTarget(attributeValue); 186 copiedAttributes.setTarget(attributeValue);
187 } 187 }
188 188
189 if (copiedAttributes.method() == DialogMethod) 189 if (copiedAttributes.method() == DialogMethod)
190 return adoptRef(new FormSubmission(submitButton->resultForDialogSubmit() )); 190 return adoptRef(new FormSubmission(submitButton->resultForDialogSubmit() ));
191 191
192 Document& document = form->document(); 192 Document& document = form->document();
193 KURL actionURL = document.completeURL(copiedAttributes.action().isEmpty() ? document.url().string() : copiedAttributes.action()); 193 KURL actionURL = document.completeURL(copiedAttributes.action().isEmpty() ? document.url().string() : copiedAttributes.action());
194 bool isMailtoForm = actionURL.protocolIs("mailto"); 194 bool isMailtoForm = actionURL.protocolIs("mailto");
195 bool isMultiPartForm = false; 195 bool isMultiPartForm = false;
196 String encodingType = copiedAttributes.encodingType(); 196 AtomicString encodingType = copiedAttributes.encodingType();
197 197
198 if (copiedAttributes.method() == PostMethod) { 198 if (copiedAttributes.method() == PostMethod) {
199 isMultiPartForm = copiedAttributes.isMultiPartForm(); 199 isMultiPartForm = copiedAttributes.isMultiPartForm();
200 if (isMultiPartForm && isMailtoForm) { 200 if (isMultiPartForm && isMailtoForm) {
201 encodingType = "application/x-www-form-urlencoded"; 201 encodingType = AtomicString("application/x-www-form-urlencoded", Ato micString::ConstructFromLiteral);
202 isMultiPartForm = false; 202 isMultiPartForm = false;
203 } 203 }
204 } 204 }
205 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input Encoding(), document.defaultCharset()); 205 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input Encoding(), document.defaultCharset());
206 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF orFormSubmission()); 206 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF orFormSubmission());
207 Vector<pair<String, String> > formValues; 207 Vector<pair<String, String> > formValues;
208 208
209 bool containsPasswordData = false; 209 bool containsPasswordData = false;
210 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { 210 for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
211 FormAssociatedElement* control = form->associatedElements()[i]; 211 FormAssociatedElement* control = form->associatedElements()[i];
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 requestURL.setQuery(m_formData->flattenToString()); 252 requestURL.setQuery(m_formData->flattenToString());
253 return requestURL; 253 return requestURL;
254 } 254 }
255 255
256 void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) 256 void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest)
257 { 257 {
258 if (!m_target.isEmpty()) 258 if (!m_target.isEmpty())
259 frameRequest.setFrameName(m_target); 259 frameRequest.setFrameName(m_target);
260 260
261 if (!m_referrer.isEmpty()) 261 if (!m_referrer.isEmpty())
262 frameRequest.resourceRequest().setHTTPReferrer(m_referrer); 262 frameRequest.resourceRequest().setHTTPReferrer(AtomicString(m_referrer)) ;
263 263
264 if (m_method == FormSubmission::PostMethod) { 264 if (m_method == FormSubmission::PostMethod) {
265 frameRequest.resourceRequest().setHTTPMethod("POST"); 265 frameRequest.resourceRequest().setHTTPMethod("POST");
266 frameRequest.resourceRequest().setHTTPBody(m_formData); 266 frameRequest.resourceRequest().setHTTPBody(m_formData);
267 267
268 // construct some user headers if necessary 268 // construct some user headers if necessary
269 if (m_boundary.isEmpty()) 269 if (m_boundary.isEmpty())
270 frameRequest.resourceRequest().setHTTPContentType(m_contentType); 270 frameRequest.resourceRequest().setHTTPContentType(m_contentType);
271 else 271 else
272 frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary); 272 frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary);
273 } 273 }
274 274
275 frameRequest.resourceRequest().setURL(requestURL()); 275 frameRequest.resourceRequest().setURL(requestURL());
276 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin) ; 276 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), AtomicStr ing(m_origin));
277 } 277 }
278 278
279 } 279 }
OLDNEW
« no previous file with comments | « Source/core/loader/FormSubmission.h ('k') | Source/core/loader/FrameFetchContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698