| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" | 5 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "content/child/image_decoder.h" | 9 #include "content/child/image_decoder.h" |
| 10 #include "content/public/renderer/resource_fetcher.h" | 10 #include "content/public/renderer/resource_fetcher.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 WebURLLoaderOptions options; | 37 WebURLLoaderOptions options; |
| 38 options.allowCredentials = true; | 38 options.allowCredentials = true; |
| 39 options.crossOriginRequestPolicy = | 39 options.crossOriginRequestPolicy = |
| 40 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; | 40 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; |
| 41 fetcher_->SetLoaderOptions(options); | 41 fetcher_->SetLoaderOptions(options); |
| 42 | 42 |
| 43 // To prevent cache tainting, the favicon requests have to by-pass the service | 43 // To prevent cache tainting, the favicon requests have to by-pass the service |
| 44 // workers. This should ideally not happen or at least not all the time. | 44 // workers. This should ideally not happen or at least not all the time. |
| 45 // See https://crbug.com/448427 | 45 // See https://crbug.com/448427 |
| 46 if (request_context == WebURLRequest::RequestContextFavicon) | 46 if (request_context == WebURLRequest::RequestContextFavicon) |
| 47 fetcher_->SetSkipServiceWorker(true); | 47 fetcher_->SetSkipServiceWorker(WebURLRequest::SkipServiceWorker::All); |
| 48 | 48 |
| 49 fetcher_->SetCachePolicy(cache_policy); | 49 fetcher_->SetCachePolicy(cache_policy); |
| 50 | 50 |
| 51 fetcher_->Start( | 51 fetcher_->Start( |
| 52 frame, | 52 frame, |
| 53 request_context, | 53 request_context, |
| 54 WebURLRequest::FrameTypeNone, | 54 WebURLRequest::FrameTypeNone, |
| 55 ResourceFetcher::FRAME_ASSOCIATED_LOADER, | 55 ResourceFetcher::FRAME_ASSOCIATED_LOADER, |
| 56 base::Bind(&MultiResolutionImageResourceFetcher::OnURLFetchComplete, | 56 base::Bind(&MultiResolutionImageResourceFetcher::OnURLFetchComplete, |
| 57 base::Unretained(this))); | 57 base::Unretained(this))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 // If we get here, it means no image from server or couldn't decode the | 76 // If we get here, it means no image from server or couldn't decode the |
| 77 // response as an image. The delegate will see an empty vector. | 77 // response as an image. The delegate will see an empty vector. |
| 78 | 78 |
| 79 // Take a reference to the callback as running the callback may lead to our | 79 // Take a reference to the callback as running the callback may lead to our |
| 80 // destruction. | 80 // destruction. |
| 81 Callback callback = callback_; | 81 Callback callback = callback_; |
| 82 callback.Run(this, bitmaps); | 82 callback.Run(this, bitmaps); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace content | 85 } // namespace content |
| OLD | NEW |