Skip to content

Commit

Permalink
Ensure that desktop notifications display for the background page. Th…
Browse files Browse the repository at this point in the history
…is regressed during

the isolation of desktop notification IPC handling into an independent object

Fixes bug http://code.google.com/p/chromium/issues/detail?id=71251

BUG=71251
TEST=As described in the bug at this point.

Review URL: http://codereview.chromium.org/6347059

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73312 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ananta@chromium.org committed Feb 1, 2011
1 parent 43e6f94 commit f203969
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions chrome/browser/tab_contents/background_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "chrome/browser/background_contents_service.h"
#include "chrome/browser/browsing_instance.h"
#include "chrome/browser/desktop_notification_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/site_instance.h"
Expand Down Expand Up @@ -39,6 +40,8 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance,
// APP_TERMINATING before non-OTR profiles are destroyed).
registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
Source<Profile>(profile));
desktop_notification_handler_.reset(
new DesktopNotificationHandler(NULL, site_instance->GetProcess()));
}

// Exposed to allow creating mocks.
Expand Down Expand Up @@ -185,6 +188,12 @@ void BackgroundContents::RenderViewGone(RenderViewHost* rvh,
delete this;
}

bool BackgroundContents::OnMessageReceived(const IPC::Message& message) {
// Forward desktop notification IPCs if any to the
// DesktopNotificationHandler.
return desktop_notification_handler_->OnMessageReceived(message);
}

RendererPreferences BackgroundContents::GetRendererPrefs(
Profile* profile) const {
RendererPreferences preferences;
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/tab_contents/background_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

class TabContents;
struct WebPreferences;
class DesktopNotificationHandler;

namespace gfx {
class Rect;
Expand Down Expand Up @@ -78,6 +79,7 @@ class BackgroundContents : public RenderViewHostDelegate,
virtual void RenderViewGone(RenderViewHost* rvh,
base::TerminationStatus status,
int error_code);
virtual bool OnMessageReceived(const IPC::Message& message);

// RenderViewHostDelegate::View
virtual void CreateNewWindow(
Expand Down Expand Up @@ -164,6 +166,9 @@ class BackgroundContents : public RenderViewHostDelegate,

NotificationRegistrar registrar_;

// Handles desktop notification IPCs.
scoped_ptr<DesktopNotificationHandler> desktop_notification_handler_;

DISALLOW_COPY_AND_ASSIGN(BackgroundContents);
};

Expand Down

0 comments on commit f203969

Please sign in to comment.