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

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

Issue 1409143004: Only allow action buttons in persistent notifications per spec update (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sw-not-props
Patch Set: Created 5 years, 1 month 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 exceptionState.throwTypeError("Illegal constructor. Use ServiceWorkerReg istration.showNotification() instead."); 72 exceptionState.throwTypeError("Illegal constructor. Use ServiceWorkerReg istration.showNotification() instead.");
73 return nullptr; 73 return nullptr;
74 } 74 }
75 75
76 // The Web Notification constructor may not be used in Service Worker contex ts. 76 // The Web Notification constructor may not be used in Service Worker contex ts.
77 if (context->isServiceWorkerGlobalScope()) { 77 if (context->isServiceWorkerGlobalScope()) {
78 exceptionState.throwTypeError("Illegal constructor."); 78 exceptionState.throwTypeError("Illegal constructor.");
79 return nullptr; 79 return nullptr;
80 } 80 }
81 81
82 if (!options.actions().isEmpty()) {
Peter Beverloo 2015/10/21 17:02:52 It's unfortunate that the place in the algorithm y
johnme 2015/10/21 18:11:31 Hmm yeah, and we can't even move this check after
83 exceptionState.throwTypeError("Actions are only supported for persistent notifications shown using ServiceWorkerRegistration.showNotification().");
84 return nullptr;
85 }
86
82 String insecureOriginMessage; 87 String insecureOriginMessage;
83 UseCounter::Feature feature = context->isSecureContext(insecureOriginMessage ) 88 UseCounter::Feature feature = context->isSecureContext(insecureOriginMessage )
84 ? UseCounter::NotificationSecureOrigin 89 ? UseCounter::NotificationSecureOrigin
85 : UseCounter::NotificationInsecureOrigin; 90 : UseCounter::NotificationInsecureOrigin;
86 91
87 UseCounter::count(context, feature); 92 UseCounter::count(context, feature);
88 93
89 WebNotificationData data = createWebNotificationData(context, title, options , exceptionState); 94 WebNotificationData data = createWebNotificationData(context, title, options , exceptionState);
90 if (exceptionState.hadException()) 95 if (exceptionState.hadException())
91 return nullptr; 96 return nullptr;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); 363 return m_state == NotificationStateShowing || m_asyncRunner.isActive();
359 } 364 }
360 365
361 DEFINE_TRACE(Notification) 366 DEFINE_TRACE(Notification)
362 { 367 {
363 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor); 368 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor);
364 ActiveDOMObject::trace(visitor); 369 ActiveDOMObject::trace(visitor);
365 } 370 }
366 371
367 } // namespace blink 372 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698