summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 17:02:36 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 17:02:36 +0000
commit6b6db57f06b8610f211d7fd8e5122447adf1fa71 (patch)
treef7b9adc85a242f59d8ebb50667035f0620694dcd /chrome/browser/notifications
parent283b6f77716b240ea352d0d52aa0613ce0a02a00 (diff)
downloadchromium_src-6b6db57f06b8610f211d7fd8e5122447adf1fa71.zip
chromium_src-6b6db57f06b8610f211d7fd8e5122447adf1fa71.tar.gz
chromium_src-6b6db57f06b8610f211d7fd8e5122447adf1fa71.tar.bz2
Correctly route the notifications permission-request-complete callback to the process/route which generated it. It might not be the same tab that's showing the infobar, particularly if it comes from an extension.
BUG=26859 TEST=request notifications permission from an extension and allow it. Review URL: http://codereview.chromium.org/378005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc12
-rw-r--r--chrome/browser/notifications/desktop_notification_service.h5
2 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index 477b505..d170891 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -100,12 +100,14 @@ class NotificationPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
NotificationPermissionInfoBarDelegate(TabContents* contents,
const GURL& origin,
+ int process_id,
+ int route_id,
int callback_context)
: ConfirmInfoBarDelegate(contents),
origin_(origin),
profile_(contents->profile()),
- process_id_(contents->process()->id()),
- route_id_(contents->render_view_host()->routing_id()),
+ process_id_(process_id),
+ route_id_(route_id),
callback_context_(callback_context),
action_taken_(false) {
}
@@ -247,7 +249,7 @@ void DesktopNotificationService::DenyPermission(const GURL& origin) {
}
void DesktopNotificationService::RequestPermission(
- const GURL& origin, int callback_context) {
+ const GURL& origin, int process_id, int route_id, int callback_context) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
// Show an info bar requesting permission.
Browser* browser = BrowserList::GetLastActive();
@@ -258,8 +260,8 @@ void DesktopNotificationService::RequestPermission(
TabContents* tab = browser->GetSelectedTabContents();
if (!tab)
return;
- tab->AddInfoBar(new NotificationPermissionInfoBarDelegate(tab, origin,
- callback_context));
+ tab->AddInfoBar(new NotificationPermissionInfoBarDelegate(
+ tab, origin, process_id, route_id, callback_context));
}
void DesktopNotificationService::ShowNotification(
diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h
index 1e1fb16..86ad6d1 100644
--- a/chrome/browser/notifications/desktop_notification_service.h
+++ b/chrome/browser/notifications/desktop_notification_service.h
@@ -33,7 +33,10 @@ class DesktopNotificationService {
// Requests permission (using an info-bar) for a given origin.
// |callback_context| contains an opaque value to pass back to the
// requesting process when the info-bar finishes.
- void RequestPermission(const GURL& origin, int callback_context);
+ void RequestPermission(const GURL& origin,
+ int process_id,
+ int route_id,
+ int callback_context);
// Takes a notification object and shows it in the UI.
void ShowNotification(const Notification& notification);