| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if (!hasClient(c)) | 150 if (!hasClient(c)) |
| 151 return; | 151 return; |
| 152 if (data()) | 152 if (data()) |
| 153 client->dataReceived(this, data()->data(), data()->size()); | 153 client->dataReceived(this, data()->data(), data()->size()); |
| 154 CHECK(!isCacheValidator()); | 154 CHECK(!isCacheValidator()); |
| 155 if (!hasClient(c)) | 155 if (!hasClient(c)) |
| 156 return; | 156 return; |
| 157 Resource::didAddClient(client); | 157 Resource::didAddClient(client); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void RawResource::willFollowRedirect(ResourceRequest& newRequest, | 160 bool RawResource::willFollowRedirect(const ResourceRequest& newRequest, |
| 161 const ResourceResponse& redirectResponse) { | 161 const ResourceResponse& redirectResponse) { |
| 162 Resource::willFollowRedirect(newRequest, redirectResponse); | 162 bool follow = Resource::willFollowRedirect(newRequest, redirectResponse); |
| 163 // The base class method takes a non const reference of a ResourceRequest |
| 164 // and returns bool just for allowing RawResource to reject redirect. It |
| 165 // must always return true. |
| 166 DCHECK(follow); |
| 163 | 167 |
| 164 DCHECK(!redirectResponse.isNull()); | 168 DCHECK(!redirectResponse.isNull()); |
| 165 ResourceClientWalker<RawResourceClient> w(clients()); | 169 ResourceClientWalker<RawResourceClient> w(clients()); |
| 166 while (RawResourceClient* c = w.next()) | 170 while (RawResourceClient* c = w.next()) { |
| 167 c->redirectReceived(this, newRequest, redirectResponse); | 171 if (!c->redirectReceived(this, newRequest, redirectResponse)) |
| 172 follow = false; |
| 173 } |
| 174 |
| 175 return follow; |
| 168 } | 176 } |
| 169 | 177 |
| 170 void RawResource::willNotFollowRedirect() { | 178 void RawResource::willNotFollowRedirect() { |
| 171 ResourceClientWalker<RawResourceClient> w(clients()); | 179 ResourceClientWalker<RawResourceClient> w(clients()); |
| 172 while (RawResourceClient* c = w.next()) | 180 while (RawResourceClient* c = w.next()) |
| 173 c->redirectBlocked(); | 181 c->redirectBlocked(); |
| 174 } | 182 } |
| 175 | 183 |
| 176 void RawResource::responseReceived( | 184 void RawResource::responseReceived( |
| 177 const ResourceResponse& response, | 185 const ResourceResponse& response, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 SECURITY_CHECK(m_state != NotAddedAsClient); | 364 SECURITY_CHECK(m_state != NotAddedAsClient); |
| 357 SECURITY_CHECK(m_state != NotifyFinished); | 365 SECURITY_CHECK(m_state != NotifyFinished); |
| 358 SECURITY_CHECK(resource->errorOccurred() || | 366 SECURITY_CHECK(resource->errorOccurred() || |
| 359 (m_state == ResponseReceived || | 367 (m_state == ResponseReceived || |
| 360 m_state == SetSerializedCachedMetadata || | 368 m_state == SetSerializedCachedMetadata || |
| 361 m_state == DataReceived || m_state == DataDownloaded)); | 369 m_state == DataReceived || m_state == DataDownloaded)); |
| 362 m_state = NotifyFinished; | 370 m_state = NotifyFinished; |
| 363 } | 371 } |
| 364 | 372 |
| 365 } // namespace blink | 373 } // namespace blink |
| OLD | NEW |