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/NotificationResourcesLoader.h" | 5 #include "modules/notifications/NotificationResourcesLoader.h" |
6 | 6 |
7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
9 #include "public/platform/modules/notifications/WebNotificationData.h" | 9 #include "public/platform/modules/notifications/WebNotificationData.h" |
10 #include "public/platform/modules/notifications/WebNotificationResources.h" | 10 #include "public/platform/modules/notifications/WebNotificationResources.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 ExecutionContext* executionContext, | 80 ExecutionContext* executionContext, |
81 NotificationImageLoader::Type type, | 81 NotificationImageLoader::Type type, |
82 const KURL& url, | 82 const KURL& url, |
83 std::unique_ptr<NotificationImageLoader::ImageCallback> imageCallback) { | 83 std::unique_ptr<NotificationImageLoader::ImageCallback> imageCallback) { |
84 if (url.isNull() || url.isEmpty() || !url.isValid()) { | 84 if (url.isNull() || url.isEmpty() || !url.isValid()) { |
85 didFinishRequest(); | 85 didFinishRequest(); |
86 return; | 86 return; |
87 } | 87 } |
88 | 88 |
89 NotificationImageLoader* imageLoader = new NotificationImageLoader(type); | 89 NotificationImageLoader* imageLoader = new NotificationImageLoader(type); |
90 m_imageLoaders.append(imageLoader); | 90 m_imageLoaders.push_back(imageLoader); |
91 imageLoader->start(executionContext, url, std::move(imageCallback)); | 91 imageLoader->start(executionContext, url, std::move(imageCallback)); |
92 } | 92 } |
93 | 93 |
94 void NotificationResourcesLoader::didLoadImage(const SkBitmap& image) { | 94 void NotificationResourcesLoader::didLoadImage(const SkBitmap& image) { |
95 m_image = NotificationImageLoader::scaleDownIfNeeded( | 95 m_image = NotificationImageLoader::scaleDownIfNeeded( |
96 image, NotificationImageLoader::Type::Image); | 96 image, NotificationImageLoader::Type::Image); |
97 didFinishRequest(); | 97 didFinishRequest(); |
98 } | 98 } |
99 | 99 |
100 void NotificationResourcesLoader::didLoadIcon(const SkBitmap& image) { | 100 void NotificationResourcesLoader::didLoadIcon(const SkBitmap& image) { |
(...skipping 21 matching lines...) Expand all Loading... |
122 DCHECK_GT(m_pendingRequestCount, 0); | 122 DCHECK_GT(m_pendingRequestCount, 0); |
123 m_pendingRequestCount--; | 123 m_pendingRequestCount--; |
124 if (!m_pendingRequestCount) { | 124 if (!m_pendingRequestCount) { |
125 stop(); | 125 stop(); |
126 (*m_completionCallback)(this); | 126 (*m_completionCallback)(this); |
127 // The |this| pointer may have been deleted now. | 127 // The |this| pointer may have been deleted now. |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 } // namespace blink | 131 } // namespace blink |
OLD | NEW |