| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
| 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL
, const SegmentedString& source) | 136 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL
, const SegmentedString& source) |
| 137 { | 137 { |
| 138 if (!shouldPreload()) | 138 if (!shouldPreload()) |
| 139 return nullptr; | 139 return nullptr; |
| 140 | 140 |
| 141 TRACE_EVENT_INSTANT1("net", "PreloadRequest", "url", m_urlToLoad.ascii()
); | 141 TRACE_EVENT_INSTANT1("net", "PreloadRequest", "url", m_urlToLoad.ascii()
); |
| 142 TextPosition position = TextPosition(source.currentLine(), source.curren
tColumn()); | 142 TextPosition position = TextPosition(source.currentLine(), source.curren
tColumn()); |
| 143 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t
agImpl), position, m_urlToLoad, predictedBaseURL, resourceType(), m_mediaAttribu
te); | 143 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t
agImpl), position, m_urlToLoad, predictedBaseURL, resourceType(), m_mediaAttribu
te); |
| 144 if (isCORSEnabled()) | 144 if (isCORSEnabled()) |
| 145 request->setCrossOriginEnabled(allowCredentials()); | 145 request->setCrossOriginEnabled(allowStoredCredentials()); |
| 146 request->setCharset(charset()); | 146 request->setCharset(charset()); |
| 147 return request.release(); | 147 return request.release(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 template<typename NameType> | 151 template<typename NameType> |
| 152 void processAttribute(const NameType& attributeName, const String& attribute
Value) | 152 void processAttribute(const NameType& attributeName, const String& attribute
Value) |
| 153 { | 153 { |
| 154 if (match(attributeName, charsetAttr)) | 154 if (match(attributeName, charsetAttr)) |
| 155 m_charset = attributeValue; | 155 m_charset = attributeValue; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (match(m_tagImpl, inputTag) && !m_inputIsImage) | 235 if (match(m_tagImpl, inputTag) && !m_inputIsImage) |
| 236 return false; | 236 return false; |
| 237 return true; | 237 return true; |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool isCORSEnabled() const | 240 bool isCORSEnabled() const |
| 241 { | 241 { |
| 242 return m_isCORSEnabled; | 242 return m_isCORSEnabled; |
| 243 } | 243 } |
| 244 | 244 |
| 245 StoredCredentials allowCredentials() const | 245 StoredCredentials allowStoredCredentials() const |
| 246 { | 246 { |
| 247 return m_allowCredentials; | 247 return m_allowCredentials; |
| 248 } | 248 } |
| 249 | 249 |
| 250 void setCrossOriginAllowed(const String& corsSetting) | 250 void setCrossOriginAllowed(const String& corsSetting) |
| 251 { | 251 { |
| 252 m_isCORSEnabled = true; | 252 m_isCORSEnabled = true; |
| 253 if (!corsSetting.isNull() && equalIgnoringCase(stripLeadingAndTrailingHT
MLSpaces(corsSetting), "use-credentials")) | 253 if (!corsSetting.isNull() && equalIgnoringCase(stripLeadingAndTrailingHT
MLSpaces(corsSetting), "use-credentials")) |
| 254 m_allowCredentials = AllowStoredCredentials; | 254 m_allowCredentials = AllowStoredCredentials; |
| 255 else | 255 else |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 if (m_token.type() == HTMLToken::StartTag) | 403 if (m_token.type() == HTMLToken::StartTag) |
| 404 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 404 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
| 405 m_scanner.scan(m_token, m_source, requests); | 405 m_scanner.scan(m_token, m_source, requests); |
| 406 m_token.clear(); | 406 m_token.clear(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 preloader->takeAndPreload(requests); | 409 preloader->takeAndPreload(requests); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } | 412 } |
| OLD | NEW |