OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
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 Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 case PlaceholderOption::ReloadPlaceholderOnDecodeError: | 452 case PlaceholderOption::ReloadPlaceholderOnDecodeError: |
453 return getStatus() == ResourceStatus::DecodeError; | 453 return getStatus() == ResourceStatus::DecodeError; |
454 case PlaceholderOption::DoNotReloadPlaceholder: | 454 case PlaceholderOption::DoNotReloadPlaceholder: |
455 return false; | 455 return false; |
456 } | 456 } |
457 NOTREACHED(); | 457 NOTREACHED(); |
458 return false; | 458 return false; |
459 } | 459 } |
460 | 460 |
461 static bool isLoFiImage(const ImageResource& resource) { | 461 static bool isLoFiImage(const ImageResource& resource) { |
462 if (!(resource.resourceRequest().previewsState() & | 462 if (resource.isLoaded()) { |
463 WebURLRequest::ServerLoFiOn)) { | 463 return resource.response() |
464 return false; | 464 .httpHeaderField("chrome-proxy-content-transform") |
| 465 .contains("empty-image"); |
465 } | 466 } |
466 return !resource.isLoaded() || | 467 return resource.resourceRequest().previewsState() & |
467 resource.response() | 468 WebURLRequest::ServerLoFiOn; |
468 .httpHeaderField("chrome-proxy-content-transform") | |
469 .contains("empty-image"); | |
470 } | 469 } |
471 | 470 |
472 void ImageResource::reloadIfLoFiOrPlaceholderImage( | 471 void ImageResource::reloadIfLoFiOrPlaceholderImage( |
473 ResourceFetcher* fetcher, | 472 ResourceFetcher* fetcher, |
474 ReloadLoFiOrPlaceholderPolicy policy) { | 473 ReloadLoFiOrPlaceholderPolicy policy) { |
475 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder()) | 474 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder()) |
476 return; | 475 return; |
477 | 476 |
478 if (m_placeholderOption == PlaceholderOption::DoNotReloadPlaceholder && | 477 if (m_placeholderOption == PlaceholderOption::DoNotReloadPlaceholder && |
479 !isLoFiImage(*this)) | 478 !isLoFiImage(*this)) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // reloading in Step 3 due to notifyObservers()'s | 591 // reloading in Step 3 due to notifyObservers()'s |
593 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. | 592 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. |
594 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher | 593 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher |
595 // (a) via didFinishLoading() called in decodeError(), or | 594 // (a) via didFinishLoading() called in decodeError(), or |
596 // (b) after returning ImageResource::updateImage(). | 595 // (b) after returning ImageResource::updateImage(). |
597 decodeError(allDataReceived); | 596 decodeError(allDataReceived); |
598 } | 597 } |
599 } | 598 } |
600 | 599 |
601 } // namespace blink | 600 } // namespace blink |
OLD | NEW |