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

Unified Diff: content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc

Issue 840553003: Use a FrameAssociatedLoader when downloading image resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/renderer/resource_fetcher.h ('k') | content/renderer/fetchers/resource_fetcher_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
diff --git a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
index 33868c3b1d9f1727073f5b13f025c6eef83fe4ac..3deb00bfdcd8f1eb0b8c7ae3fced26178be473ee 100644
--- a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
+++ b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
@@ -10,10 +10,12 @@
#include "content/public/renderer/resource_fetcher.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
using blink::WebFrame;
+using blink::WebURLLoaderOptions;
using blink::WebURLRequest;
using blink::WebURLResponse;
@@ -30,11 +32,24 @@ MultiResolutionImageResourceFetcher::MultiResolutionImageResourceFetcher(
http_status_code_(0),
image_url_(image_url) {
fetcher_.reset(ResourceFetcher::Create(image_url));
+
+ WebURLLoaderOptions options;
+ options.allowCredentials = true;
+ options.crossOriginRequestPolicy =
+ WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
+ fetcher_->SetLoaderOptions(options);
+
+ // To prevent cache tainting, the favicon requests have to by-pass the service
+ // workers. This should ideally not happen or at least not all the time.
+ // See https://crbug.com/448427
+ if (request_context == WebURLRequest::RequestContextFavicon)
+ fetcher_->SetSkipServiceWorker(true);
+
fetcher_->Start(
frame,
request_context,
WebURLRequest::FrameTypeNone,
- ResourceFetcher::PLATFORM_LOADER,
+ ResourceFetcher::FRAME_ASSOCIATED_LOADER,
base::Bind(&MultiResolutionImageResourceFetcher::OnURLFetchComplete,
base::Unretained(this)));
}
« no previous file with comments | « content/public/renderer/resource_fetcher.h ('k') | content/renderer/fetchers/resource_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698