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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResource.cpp

Issue 2800473002: Treat responses with legacy LoFi headers as LoFi images. (Closed)
Patch Set: Added comment describing CPCT header format Created 3 years, 8 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
OLDNEW
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.isLoaded()) { 462 if (resource.isLoaded()) {
463 return resource.response() 463 return resource.response()
464 .httpHeaderField("chrome-proxy-content-transform") 464 .httpHeaderField("chrome-proxy-content-transform")
465 .contains("empty-image"); 465 .contains("empty-image") ||
466 resource.response()
467 .httpHeaderField("chrome-proxy")
468 .contains("q=low");
466 } 469 }
467 return resource.resourceRequest().previewsState() & 470 return resource.resourceRequest().previewsState() &
468 WebURLRequest::ServerLoFiOn; 471 WebURLRequest::ServerLoFiOn;
469 } 472 }
470 473
471 void ImageResource::reloadIfLoFiOrPlaceholderImage( 474 void ImageResource::reloadIfLoFiOrPlaceholderImage(
472 ResourceFetcher* fetcher, 475 ResourceFetcher* fetcher,
473 ReloadLoFiOrPlaceholderPolicy policy) { 476 ReloadLoFiOrPlaceholderPolicy policy) {
474 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder()) 477 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder())
475 return; 478 return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // reloading in Step 3 due to notifyObservers()'s 594 // reloading in Step 3 due to notifyObservers()'s
592 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. 595 // schedulingReloadOrShouldReloadBrokenPlaceholder() check.
593 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher 596 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher
594 // (a) via didFinishLoading() called in decodeError(), or 597 // (a) via didFinishLoading() called in decodeError(), or
595 // (b) after returning ImageResource::updateImage(). 598 // (b) after returning ImageResource::updateImage().
596 decodeError(allDataReceived); 599 decodeError(allDataReceived);
597 } 600 }
598 } 601 }
599 602
600 } // namespace blink 603 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698