summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 22:43:52 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 22:43:52 +0000
commit83ab5f200ee5c9601bfa60d1786f99c77ff1a88a (patch)
tree18ef37d863f7789d45b4a86863fd6619b9e6f293 /chrome/renderer
parent3e7fdb8e84bebac34195fa298330cabdf383e26e (diff)
downloadchromium_src-83ab5f200ee5c9601bfa60d1786f99c77ff1a88a.zip
chromium_src-83ab5f200ee5c9601bfa60d1786f99c77ff1a88a.tar.gz
chromium_src-83ab5f200ee5c9601bfa60d1786f99c77ff1a88a.tar.bz2
Notifications permission infobar should only be shown in response to a user gesture, not arbitrary script.
Includes UI test which verify the infobar is shown from a gesture, and not shown from raw script. BUG=27215 TEST=included Review URL: http://codereview.chromium.org/387011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31839 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/notification_provider.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/chrome/renderer/notification_provider.cc b/chrome/renderer/notification_provider.cc
index 9510cab..6746350 100644
--- a/chrome/renderer/notification_provider.cc
+++ b/chrome/renderer/notification_provider.cc
@@ -55,6 +55,10 @@ WebNotificationPresenter::Permission NotificationProvider::checkPermission(
void NotificationProvider::requestPermission(
const WebString& origin, WebNotificationPermissionCallback* callback) {
+ // We only request permission in response to a user gesture.
+ if (!view_->webview()->mainFrame()->isProcessingUserGesture())
+ return;
+
int id = manager_.RegisterPermissionRequest(callback);
Send(new ViewHostMsg_RequestNotificationPermission(view_->routing_id(),