summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authortonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 02:43:20 +0000
committertonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 02:43:20 +0000
commit132db96c5f8dba976c631e2ff56180a5d92f9dc9 (patch)
treefbcd8a74349ef048fa2526378db733ae74bfa9b6 /chrome/browser/notifications
parent038b29624ba801c52b452f2976ebe4090e83423b (diff)
downloadchromium_src-132db96c5f8dba976c631e2ff56180a5d92f9dc9.zip
chromium_src-132db96c5f8dba976c631e2ff56180a5d92f9dc9.tar.gz
chromium_src-132db96c5f8dba976c631e2ff56180a5d92f9dc9.tar.bz2
Revert 48348 - Broke ui_tests on linux.
The desktop notification service infobar would not display in ChromeFrame rendered pages as the code assumed the existing of a BrowserList and associated objects like Browser etc. In ChromeFrame the tab contents is owned by the ExternalTabContainer. Fix is to pass the current tab contents from the RenderViewHost to the DesktopNotificationService::RequestPermission function and use that if we don't have a browser list. Fixes bug http://code.google.com/p/chromium/issues/detail?id=44913 Bug=44913 Review URL: http://codereview.chromium.org/2294002 TBR=ananta@chromium.org Review URL: http://codereview.chromium.org/2222005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc13
-rw-r--r--chrome/browser/notifications/desktop_notification_service.h4
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 f0eb62d..53cc37b 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -8,6 +8,7 @@
#include "app/resource_bundle.h"
#include "base/thread.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/child_process_host.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/extensions/extensions_service.h"
@@ -375,12 +376,18 @@ void DesktopNotificationService::PersistPermissionChange(
}
void DesktopNotificationService::RequestPermission(
- const GURL& origin, int process_id, int route_id, int callback_context,
- TabContents* tab) {
+ 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();
+ if (!browser) {
+ // Reached during ui tests.
+ return;
+ }
+ TabContents* tab = browser->GetSelectedTabContents();
if (!tab)
return;
- // Show an info bar requesting permission.
+
std::wstring display_name = DisplayNameForOrigin(origin);
tab->AddInfoBar(new NotificationPermissionInfoBarDelegate(
diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h
index 4a651f8..c3a41f9 100644
--- a/chrome/browser/notifications/desktop_notification_service.h
+++ b/chrome/browser/notifications/desktop_notification_service.h
@@ -19,7 +19,6 @@ class NotificationsPrefsCache;
class PrefService;
class Profile;
class Task;
-class TabContents;
// The DesktopNotificationService is an object, owned by the Profile,
// which provides the creation of desktop "toasts" to web pages and workers.
@@ -40,8 +39,7 @@ class DesktopNotificationService : public NotificationObserver {
void RequestPermission(const GURL& origin,
int process_id,
int route_id,
- int callback_context,
- TabContents* tab);
+ int callback_context);
// Takes a notification object and shows it in the UI.
void ShowNotification(const Notification& notification);