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

Unified Diff: third_party/WebKit/Source/modules/notifications/Notification.h

Issue 1847863002: Move notification resource loading from content/child to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 4 years, 8 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
Index: third_party/WebKit/Source/modules/notifications/Notification.h
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.h b/third_party/WebKit/Source/modules/notifications/Notification.h
index 771751f9a274416ccb3d084cb7db7dfc70229534..e3e0b628dab804689b65fa9979f03b04573123e7 100644
--- a/third_party/WebKit/Source/modules/notifications/Notification.h
+++ b/third_party/WebKit/Source/modules/notifications/Notification.h
@@ -54,6 +54,7 @@ class ExecutionContext;
class NotificationAction;
class NotificationOptions;
class NotificationPermissionCallback;
+class NotificationResourcesLoader;
class ScriptState;
class MODULES_EXPORT Notification final : public EventTargetWithInlineData, public ActiveScriptWrappable, public ActiveDOMObject, public WebNotificationDelegate {
@@ -124,14 +125,17 @@ protected:
private:
Notification(ExecutionContext*, const WebNotificationData&);
- void scheduleShow();
+ // Schedules an asynchronous call to |prepareShow|, allowing the constructor
+ // to return so that events can be fired on the notification object.
+ void schedulePrepareShow();
- // Calling show() may start asynchronous operation. If this object has
- // a V8 wrapper, hasPendingActivity() prevents the wrapper from being
- // collected while m_state is Showing, and so this instance stays alive
- // until the operation completes. Otherwise, you need to hold a ref on this
- // instance until the operation completes.
- void show();
+ // Checks permission and loads any necessary resources (this may be async)
+ // before showing the notification.
+ void prepareShow();
+
+ // Shows the notification, using the resources loaded by the
+ // NotificationResourcesLoader.
+ void didLoadResources(NotificationResourcesLoader*);
void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; }
@@ -158,7 +162,9 @@ private:
NotificationState m_state;
- Member<AsyncMethodRunner<Notification>> m_asyncRunner;
+ Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner;
+
+ Member<NotificationResourcesLoader> m_loader;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698