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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (exceptionState.hadException()) 98 if (exceptionState.hadException())
99 return nullptr; 99 return nullptr;
100 100
101 Notification* notification = new Notification(context, data); 101 Notification* notification = new Notification(context, data);
102 notification->scheduleShow(); 102 notification->scheduleShow();
103 notification->suspendIfNeeded(); 103 notification->suspendIfNeeded();
104 104
105 return notification; 105 return notification;
106 } 106 }
107 107
108 Notification* Notification::create(ExecutionContext* context, int64_t persistent Id, const WebNotificationData& data) 108 Notification* Notification::create(ExecutionContext* context, int64_t persistent Id, const WebNotificationData& data, bool showing)
109 { 109 {
110 Notification* notification = new Notification(context, data); 110 Notification* notification = new Notification(context, data);
111 notification->setPersistentId(persistentId); 111 notification->setPersistentId(persistentId);
112 notification->setState(NotificationStateShowing); 112 notification->setState(showing ? NotificationStateShowing : NotificationStat eClosed);
113 notification->suspendIfNeeded(); 113 notification->suspendIfNeeded();
114 114
115 return notification; 115 return notification;
116 } 116 }
117 117
118 Notification::Notification(ExecutionContext* context, const WebNotificationData& data) 118 Notification::Notification(ExecutionContext* context, const WebNotificationData& data)
119 : ActiveDOMObject(context) 119 : ActiveDOMObject(context)
120 , m_data(data) 120 , m_data(data)
121 , m_persistentId(kInvalidPersistentId) 121 , m_persistentId(kInvalidPersistentId)
122 , m_state(NotificationStateIdle) 122 , m_state(NotificationStateIdle)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 DEFINE_TRACE(Notification) 374 DEFINE_TRACE(Notification)
375 { 375 {
376 visitor->trace(m_asyncRunner); 376 visitor->trace(m_asyncRunner);
377 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor); 377 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor);
378 ActiveDOMObject::trace(visitor); 378 ActiveDOMObject::trace(visitor);
379 } 379 }
380 380
381 } // namespace blink 381 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698