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

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: Rebased on master 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::kDoNotReloadPlaceholder: 454 case PlaceholderOption::kDoNotReloadPlaceholder:
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.GetResponse() 463 return resource.GetResponse()
464 .HttpHeaderField("chrome-proxy-content-transform") 464 .HttpHeaderField("chrome-proxy-content-transform")
465 .Contains("empty-image"); 465 .Contains("empty-image") ||
466 resource.GetResponse()
467 .HttpHeaderField("chrome-proxy")
468 .Contains("q=low");
466 } 469 }
467 return resource.GetResourceRequest().GetPreviewsState() & 470 return resource.GetResourceRequest().GetPreviewsState() &
468 WebURLRequest::kServerLoFiOn; 471 WebURLRequest::kServerLoFiOn;
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(all_data_received); 599 DecodeError(all_data_received);
597 } 600 }
598 } 601 }
599 602
600 } // namespace blink 603 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698