| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google, Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 FetchRequest::~FetchRequest() {} | 72 FetchRequest::~FetchRequest() {} |
| 73 | 73 |
| 74 void FetchRequest::setCrossOriginAccessControl( | 74 void FetchRequest::setCrossOriginAccessControl( |
| 75 SecurityOrigin* origin, | 75 SecurityOrigin* origin, |
| 76 CrossOriginAttributeValue crossOrigin) { | 76 CrossOriginAttributeValue crossOrigin) { |
| 77 DCHECK_NE(crossOrigin, CrossOriginAttributeNotSet); | 77 DCHECK_NE(crossOrigin, CrossOriginAttributeNotSet); |
| 78 const bool useCredentials = crossOrigin == CrossOriginAttributeUseCredentials; | 78 const bool useCredentials = crossOrigin == CrossOriginAttributeUseCredentials; |
| 79 const bool isSameOriginRequest = | 79 const bool isSameOriginRequest = |
| 80 origin && origin->canRequestNoSuborigin(m_resourceRequest.url()); | 80 origin && origin->canRequestNoSuborigin(m_resourceRequest.url()); |
| 81 | 81 |
| 82 // Currently FetchRequestMode and FetchCredentialsMode are only used when the
request goes to Service Worker. | 82 // Currently FetchRequestMode and FetchCredentialsMode are only used when the |
| 83 // request goes to Service Worker. |
| 83 m_resourceRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); | 84 m_resourceRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); |
| 84 m_resourceRequest.setFetchCredentialsMode( | 85 m_resourceRequest.setFetchCredentialsMode( |
| 85 useCredentials ? WebURLRequest::FetchCredentialsModeInclude | 86 useCredentials ? WebURLRequest::FetchCredentialsModeInclude |
| 86 : WebURLRequest::FetchCredentialsModeSameOrigin); | 87 : WebURLRequest::FetchCredentialsModeSameOrigin); |
| 87 | 88 |
| 88 m_options.allowCredentials = (isSameOriginRequest || useCredentials) | 89 m_options.allowCredentials = (isSameOriginRequest || useCredentials) |
| 89 ? AllowStoredCredentials | 90 ? AllowStoredCredentials |
| 90 : DoNotAllowStoredCredentials; | 91 : DoNotAllowStoredCredentials; |
| 91 m_options.corsEnabled = IsCORSEnabled; | 92 m_options.corsEnabled = IsCORSEnabled; |
| 92 m_options.securityOrigin = origin; | 93 m_options.securityOrigin = origin; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 104 m_resourceWidth.isSet = true; | 105 m_resourceWidth.isSet = true; |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 void FetchRequest::setForPreload(bool forPreload, double discoveryTime) { | 109 void FetchRequest::setForPreload(bool forPreload, double discoveryTime) { |
| 109 m_forPreload = forPreload; | 110 m_forPreload = forPreload; |
| 110 m_preloadDiscoveryTime = discoveryTime; | 111 m_preloadDiscoveryTime = discoveryTime; |
| 111 } | 112 } |
| 112 | 113 |
| 113 void FetchRequest::makeSynchronous() { | 114 void FetchRequest::makeSynchronous() { |
| 114 // Synchronous requests should always be max priority, lest they hang the rend
erer. | 115 // Synchronous requests should always be max priority, lest they hang the |
| 116 // renderer. |
| 115 m_resourceRequest.setPriority(ResourceLoadPriorityHighest); | 117 m_resourceRequest.setPriority(ResourceLoadPriorityHighest); |
| 116 m_resourceRequest.setTimeoutInterval(10); | 118 m_resourceRequest.setTimeoutInterval(10); |
| 117 m_options.synchronousPolicy = RequestSynchronously; | 119 m_options.synchronousPolicy = RequestSynchronously; |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |