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

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: added comment 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (c->getImageAnimationPolicy(this, newPolicy)) 425 if (c->getImageAnimationPolicy(this, newPolicy))
426 break; 426 break;
427 } 427 }
428 428
429 if (m_image->animationPolicy() != newPolicy) { 429 if (m_image->animationPolicy() != newPolicy) {
430 m_image->resetAnimation(); 430 m_image->resetAnimation();
431 m_image->setAnimationPolicy(newPolicy); 431 m_image->setAnimationPolicy(newPolicy);
432 } 432 }
433 } 433 }
434 434
435 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher)
436 {
437 if (!m_response.httpHeaderField("chrome-proxy").contains("q=low"))
438 return;
439 m_resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadBypassing Cache);
440 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
441 error(Resource::LoadError);
442 load(fetcher, fetcher->defaultResourceOptions());
443 }
444
435 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 445 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
436 { 446 {
437 if (!image || image != m_image) 447 if (!image || image != m_image)
438 return; 448 return;
439 notifyObservers(&rect); 449 notifyObservers(&rect);
440 } 450 }
441 451
442 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) 452 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin)
443 { 453 {
444 if (response().wasFetchedViaServiceWorker()) 454 if (response().wasFetchedViaServiceWorker())
445 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 455 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
446 if (!image()->currentFrameHasSingleSecurityOrigin()) 456 if (!image()->currentFrameHasSingleSecurityOrigin())
447 return false; 457 return false;
448 if (passesAccessControlCheck(securityOrigin)) 458 if (passesAccessControlCheck(securityOrigin))
449 return true; 459 return true;
450 return !securityOrigin->taintsCanvas(response().url()); 460 return !securityOrigin->taintsCanvas(response().url());
451 } 461 }
452 462
453 bool ImageResource::loadingMultipartContent() const 463 bool ImageResource::loadingMultipartContent() const
454 { 464 {
455 return m_loader && m_loader->loadingMultipartContent(); 465 return m_loader && m_loader->loadingMultipartContent();
456 } 466 }
457 467
458 } // namespace blink 468 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698