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/WebNotificationConstants.h" | 9 #include "public/platform/modules/notifications/WebNotificationConstants.h" |
10 #include "public/platform/modules/notifications/WebNotificationData.h" | 10 #include "public/platform/modules/notifications/WebNotificationData.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 void NotificationResourcesLoader::start(ExecutionContext* executionContext, cons
t WebNotificationData& notificationData) | 50 void NotificationResourcesLoader::start(ExecutionContext* executionContext, cons
t WebNotificationData& notificationData) |
51 { | 51 { |
52 DCHECK(!m_started); | 52 DCHECK(!m_started); |
53 m_started = true; | 53 m_started = true; |
54 | 54 |
55 size_t numActions = notificationData.actions.size(); | 55 size_t numActions = notificationData.actions.size(); |
56 m_pendingRequestCount = 2 /* icon and badge */ + numActions; | 56 m_pendingRequestCount = 2 /* icon and badge */ + numActions; |
57 | 57 |
58 loadImage(executionContext, notificationData.icon, bind(&NotificationResourc
esLoader::didLoadIcon, wrapWeakPersistent(this))); | 58 loadImage(executionContext, notificationData.icon, WTF::bind(&NotificationRe
sourcesLoader::didLoadIcon, wrapWeakPersistent(this))); |
59 loadImage(executionContext, notificationData.badge, bind(&NotificationResour
cesLoader::didLoadBadge, wrapWeakPersistent(this))); | 59 loadImage(executionContext, notificationData.badge, WTF::bind(&NotificationR
esourcesLoader::didLoadBadge, wrapWeakPersistent(this))); |
60 | 60 |
61 m_actionIcons.resize(numActions); | 61 m_actionIcons.resize(numActions); |
62 for (size_t i = 0; i < numActions; i++) | 62 for (size_t i = 0; i < numActions; i++) |
63 loadImage(executionContext, notificationData.actions[i].icon, bind(&Noti
ficationResourcesLoader::didLoadActionIcon, wrapWeakPersistent(this), i)); | 63 loadImage(executionContext, notificationData.actions[i].icon, WTF::bind(
&NotificationResourcesLoader::didLoadActionIcon, wrapWeakPersistent(this), i)); |
64 } | 64 } |
65 | 65 |
66 std::unique_ptr<WebNotificationResources> NotificationResourcesLoader::getResour
ces() const | 66 std::unique_ptr<WebNotificationResources> NotificationResourcesLoader::getResour
ces() const |
67 { | 67 { |
68 std::unique_ptr<WebNotificationResources> resources(new WebNotificationResou
rces()); | 68 std::unique_ptr<WebNotificationResources> resources(new WebNotificationResou
rces()); |
69 resources->icon = m_icon; | 69 resources->icon = m_icon; |
70 resources->badge = m_badge; | 70 resources->badge = m_badge; |
71 resources->actionIcons = m_actionIcons; | 71 resources->actionIcons = m_actionIcons; |
72 return resources; | 72 return resources; |
73 } | 73 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DCHECK_GT(m_pendingRequestCount, 0); | 120 DCHECK_GT(m_pendingRequestCount, 0); |
121 m_pendingRequestCount--; | 121 m_pendingRequestCount--; |
122 if (!m_pendingRequestCount) { | 122 if (!m_pendingRequestCount) { |
123 stop(); | 123 stop(); |
124 (*m_completionCallback)(this); | 124 (*m_completionCallback)(this); |
125 // The |this| pointer may have been deleted now. | 125 // The |this| pointer may have been deleted now. |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 } // namespace blink | 129 } // namespace blink |
OLD | NEW |