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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 333143003: Fix style errors in core/xml/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 WTF_LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().ut f8().data()); 710 WTF_LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().ut f8().data());
711 711
712 if (!initSend(exceptionState)) 712 if (!initSend(exceptionState))
713 return; 713 return;
714 714
715 RefPtr<FormData> httpBody; 715 RefPtr<FormData> httpBody;
716 716
717 if (areMethodAndURLValidForSend()) { 717 if (areMethodAndURLValidForSend()) {
718 if (getRequestHeader("Content-Type").isEmpty()) { 718 if (getRequestHeader("Content-Type").isEmpty()) {
719 const String& blobType = body->type(); 719 const String& blobType = body->type();
720 if (!blobType.isEmpty() && isValidContentType(blobType)) 720 if (!blobType.isEmpty() && isValidContentType(blobType)) {
721 setRequestHeaderInternal("Content-Type", AtomicString(blobType)) ; 721 setRequestHeaderInternal("Content-Type", AtomicString(blobType)) ;
722 else { 722 } else {
723 // From FileAPI spec, whenever media type cannot be determined, empty string must be returned. 723 // From FileAPI spec, whenever media type cannot be determined,
724 // empty string must be returned.
724 setRequestHeaderInternal("Content-Type", ""); 725 setRequestHeaderInternal("Content-Type", "");
725 } 726 }
726 } 727 }
727 728
728 // FIXME: add support for uploading bundles. 729 // FIXME: add support for uploading bundles.
729 httpBody = FormData::create(); 730 httpBody = FormData::create();
730 if (body->hasBackingFile()) { 731 if (body->hasBackingFile()) {
731 File* file = toFile(body); 732 File* file = toFile(body);
732 if (!file->path().isEmpty()) 733 if (!file->path().isEmpty())
733 httpBody->appendFile(file->path()); 734 httpBody->appendFile(file->path());
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1339
1339 if (m_error) 1340 if (m_error)
1340 return; 1341 return;
1341 1342
1342 if (m_state < HEADERS_RECEIVED) 1343 if (m_state < HEADERS_RECEIVED)
1343 changeState(HEADERS_RECEIVED); 1344 changeState(HEADERS_RECEIVED);
1344 1345
1345 bool useDecoder = m_responseTypeCode == ResponseTypeDefault || m_responseTyp eCode == ResponseTypeText || m_responseTypeCode == ResponseTypeJSON || m_respons eTypeCode == ResponseTypeDocument; 1346 bool useDecoder = m_responseTypeCode == ResponseTypeDefault || m_responseTyp eCode == ResponseTypeText || m_responseTypeCode == ResponseTypeJSON || m_respons eTypeCode == ResponseTypeDocument;
1346 1347
1347 if (useDecoder && !m_decoder) { 1348 if (useDecoder && !m_decoder) {
1348 if (m_responseTypeCode == ResponseTypeJSON) 1349 if (m_responseTypeCode == ResponseTypeJSON) {
1349 m_decoder = TextResourceDecoder::create("application/json", "UTF-8") ; 1350 m_decoder = TextResourceDecoder::create("application/json", "UTF-8") ;
1350 else if (!m_responseEncoding.isEmpty()) 1351 } else if (!m_responseEncoding.isEmpty()) {
1351 m_decoder = TextResourceDecoder::create("text/plain", m_responseEnco ding); 1352 m_decoder = TextResourceDecoder::create("text/plain", m_responseEnco ding);
1352 // allow TextResourceDecoder to look inside the m_response if it's XML o r HTML 1353 // allow TextResourceDecoder to look inside the m_response if it's XML o r HTML
1353 else if (responseIsXML()) { 1354 } else if (responseIsXML()) {
1354 m_decoder = TextResourceDecoder::create("application/xml"); 1355 m_decoder = TextResourceDecoder::create("application/xml");
1355 // Don't stop on encoding errors, unlike it is done for other kinds of XML resources. This matches the behavior of previous WebKit versions, Firefox and Opera. 1356 // Don't stop on encoding errors, unlike it is done for other kinds
1357 // of XML resources. This matches the behavior of previous WebKit
1358 // versions, Firefox and Opera.
1356 m_decoder->useLenientXMLDecoding(); 1359 m_decoder->useLenientXMLDecoding();
1357 } else if (equalIgnoringCase(responseMIMEType(), "text/html")) 1360 } else if (equalIgnoringCase(responseMIMEType(), "text/html")) {
1358 m_decoder = TextResourceDecoder::create("text/html", "UTF-8"); 1361 m_decoder = TextResourceDecoder::create("text/html", "UTF-8");
1359 else 1362 } else {
1360 m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); 1363 m_decoder = TextResourceDecoder::create("text/plain", "UTF-8");
1364 }
1361 } 1365 }
1362 1366
1363 if (!len) 1367 if (!len)
1364 return; 1368 return;
1365 1369
1366 if (len == -1) 1370 if (len == -1)
1367 len = strlen(data); 1371 len = strlen(data);
1368 1372
1369 if (useDecoder) { 1373 if (useDecoder) {
1370 m_responseText = m_responseText.concatenateWith(m_decoder->decode(data, len)); 1374 m_responseText = m_responseText.concatenateWith(m_decoder->decode(data, len));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 { 1465 {
1462 visitor->trace(m_responseBlob); 1466 visitor->trace(m_responseBlob);
1463 visitor->trace(m_responseStream); 1467 visitor->trace(m_responseStream);
1464 visitor->trace(m_responseDocument); 1468 visitor->trace(m_responseDocument);
1465 visitor->trace(m_progressEventThrottle); 1469 visitor->trace(m_progressEventThrottle);
1466 visitor->trace(m_upload); 1470 visitor->trace(m_upload);
1467 XMLHttpRequestEventTarget::trace(visitor); 1471 XMLHttpRequestEventTarget::trace(visitor);
1468 } 1472 }
1469 1473
1470 } // namespace WebCore 1474 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XMLHttpRequest.h ('k') | Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698