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

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

Issue 600773002: Notify in console when an API fails because it needs to be invoked on user action. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return deniedPermission; 154 return deniedPermission;
155 } 155 }
156 156
157 const String& Notification::permission(ExecutionContext* context) 157 const String& Notification::permission(ExecutionContext* context)
158 { 158 {
159 return permissionString(NotificationController::clientFrom(context).checkPer mission(context)); 159 return permissionString(NotificationController::clientFrom(context).checkPer mission(context));
160 } 160 }
161 161
162 void Notification::requestPermission(ExecutionContext* context, PassOwnPtrWillBe RawPtr<NotificationPermissionCallback> callback) 162 void Notification::requestPermission(ExecutionContext* context, PassOwnPtrWillBe RawPtr<NotificationPermissionCallback> callback)
163 { 163 {
164 if (!UserGestureIndicator::processingUserGesture()) {
165 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni ngMessageLevel,
166 "Notification.requestPermission() was invoked by script, without any user interaction involved!"));
167 }
Peter Beverloo 2014/09/24 14:59:44 We removed the user gesture requirement for reques
Mayur Kankanwadi 2014/09/24 15:03:42 No, not seeing any permission dialog for notificat
Peter Beverloo 2014/09/24 17:14:20 I made a test-page here: http://peter.sh/files/n
meacer 2014/09/24 17:59:21 I agree, a gesture isn't required for this API so
Mayur Kankanwadi 2014/09/25 06:43:01 Done.
164 // FIXME: Assert that this code-path will only be reached for Document envir onments 168 // FIXME: Assert that this code-path will only be reached for Document envir onments
165 // when Blink supports [Exposed] annotations on class members in IDL definit ions. 169 // when Blink supports [Exposed] annotations on class members in IDL definit ions.
166 if (NotificationPermissionClient* permissionClient = NotificationPermissionC lient::from(context)) { 170 if (NotificationPermissionClient* permissionClient = NotificationPermissionC lient::from(context)) {
167 permissionClient->requestPermission(context, callback); 171 permissionClient->requestPermission(context, callback);
168 return; 172 return;
169 } 173 }
170 } 174 }
171 175
172 bool Notification::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 176 bool Notification::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
173 { 177 {
(...skipping 18 matching lines...) Expand all
192 196
193 m_asyncRunner.stop(); 197 m_asyncRunner.stop();
194 } 198 }
195 199
196 bool Notification::hasPendingActivity() const 200 bool Notification::hasPendingActivity() const
197 { 201 {
198 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); 202 return m_state == NotificationStateShowing || m_asyncRunner.isActive();
199 } 203 }
200 204
201 } // namespace blink 205 } // namespace blink
OLDNEW
« Source/core/page/PointerLockController.cpp ('K') | « Source/core/page/PointerLockController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698