| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/notifications/NotificationImageLoader.h" | 5 #include "modules/notifications/NotificationImageLoader.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
| 8 #include "core/fetch/ResourceLoaderOptions.h" | 8 #include "core/fetch/ResourceLoaderOptions.h" |
| 9 #include "platform/Histogram.h" | 9 #include "platform/Histogram.h" |
| 10 #include "platform/image-decoders/ImageDecoder.h" | 10 #include "platform/image-decoders/ImageDecoder.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 DCHECK(!m_stopped); | 33 DCHECK(!m_stopped); |
| 34 | 34 |
| 35 m_startTime = monotonicallyIncreasingTimeMS(); | 35 m_startTime = monotonicallyIncreasingTimeMS(); |
| 36 m_imageCallback = std::move(imageCallback); | 36 m_imageCallback = std::move(imageCallback); |
| 37 | 37 |
| 38 // TODO(mvanouwerkerk): Add a timeout mechanism: crbug.com/579137. | 38 // TODO(mvanouwerkerk): Add a timeout mechanism: crbug.com/579137. |
| 39 ThreadableLoaderOptions threadableLoaderOptions; | 39 ThreadableLoaderOptions threadableLoaderOptions; |
| 40 threadableLoaderOptions.preflightPolicy = PreventPreflight; | 40 threadableLoaderOptions.preflightPolicy = PreventPreflight; |
| 41 threadableLoaderOptions.crossOriginRequestPolicy = AllowCrossOriginRequests; | 41 threadableLoaderOptions.crossOriginRequestPolicy = AllowCrossOriginRequests; |
| 42 | 42 |
| 43 // TODO(mvanouwerkerk): Add an entry for notifications to FetchInitiatorTypeNa
mes and use it. | 43 // TODO(mvanouwerkerk): Add an entry for notifications to |
| 44 // FetchInitiatorTypeNames and use it. |
| 44 ResourceLoaderOptions resourceLoaderOptions; | 45 ResourceLoaderOptions resourceLoaderOptions; |
| 45 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; | 46 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; |
| 46 if (executionContext->isWorkerGlobalScope()) | 47 if (executionContext->isWorkerGlobalScope()) |
| 47 resourceLoaderOptions.requestInitiatorContext = WorkerContext; | 48 resourceLoaderOptions.requestInitiatorContext = WorkerContext; |
| 48 | 49 |
| 49 ResourceRequest resourceRequest(url); | 50 ResourceRequest resourceRequest(url); |
| 50 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage); | 51 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage); |
| 51 resourceRequest.setPriority(ResourceLoadPriorityMedium); | 52 resourceRequest.setPriority(ResourceLoadPriorityMedium); |
| 52 resourceRequest.setRequestorOrigin(executionContext->getSecurityOrigin()); | 53 resourceRequest.setRequestorOrigin(executionContext->getSecurityOrigin()); |
| 53 | 54 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void NotificationImageLoader::runCallbackWithEmptyBitmap() { | 129 void NotificationImageLoader::runCallbackWithEmptyBitmap() { |
| 129 // If this has been stopped it is not desirable to trigger further work, | 130 // If this has been stopped it is not desirable to trigger further work, |
| 130 // there is a shutdown of some sort in progress. | 131 // there is a shutdown of some sort in progress. |
| 131 if (m_stopped) | 132 if (m_stopped) |
| 132 return; | 133 return; |
| 133 | 134 |
| 134 (*m_imageCallback)(SkBitmap()); | 135 (*m_imageCallback)(SkBitmap()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |