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

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

Issue 1624583003: Reload Lo-Fi images inline instead of reloading the whole page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding blink test Created 4 years, 10 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (c->getImageAnimationPolicy(this, newPolicy)) 430 if (c->getImageAnimationPolicy(this, newPolicy))
431 break; 431 break;
432 } 432 }
433 433
434 if (m_image->animationPolicy() != newPolicy) { 434 if (m_image->animationPolicy() != newPolicy) {
435 m_image->resetAnimation(); 435 m_image->resetAnimation();
436 m_image->setAnimationPolicy(newPolicy); 436 m_image->setAnimationPolicy(newPolicy);
437 } 437 }
438 } 438 }
439 439
440 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher)
441 {
442 if (!m_response.httpHeaderField("chrome-proxy").contains("q=low"))
443 return;
444 m_resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadBypassing Cache);
445 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
446 error(Resource::LoadError);
447 load(fetcher, fetcher->defaultResourceOptions());
448 }
449
440 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 450 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
441 { 451 {
442 if (!image || image != m_image) 452 if (!image || image != m_image)
443 return; 453 return;
444 notifyObservers(&rect); 454 notifyObservers(&rect);
445 } 455 }
446 456
447 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) 457 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin)
448 { 458 {
449 if (response().wasFetchedViaServiceWorker()) 459 if (response().wasFetchedViaServiceWorker())
450 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 460 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
451 if (!image()->currentFrameHasSingleSecurityOrigin()) 461 if (!image()->currentFrameHasSingleSecurityOrigin())
452 return false; 462 return false;
453 if (passesAccessControlCheck(securityOrigin)) 463 if (passesAccessControlCheck(securityOrigin))
454 return true; 464 return true;
455 return !securityOrigin->taintsCanvas(response().url()); 465 return !securityOrigin->taintsCanvas(response().url());
456 } 466 }
457 467
458 bool ImageResource::loadingMultipartContent() const 468 bool ImageResource::loadingMultipartContent() const
459 { 469 {
460 return m_loader && m_loader->loadingMultipartContent(); 470 return m_loader && m_loader->loadingMultipartContent();
461 } 471 }
462 472
463 } // namespace blink 473 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698