| Index: chrome/browser/notifications/balloon_host.cc
|
| diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
|
| index d24f3d770b75c794c130b1d71901b05d1846e65f..5380dc2577076dc1bdf6b2a263d003a3dc9e4294 100644
|
| --- a/chrome/browser/notifications/balloon_host.cc
|
| +++ b/chrome/browser/notifications/balloon_host.cc
|
| @@ -20,30 +20,6 @@
|
| #include "chrome/common/url_constants.h"
|
| #include "webkit/glue/webpreferences.h"
|
|
|
| -namespace {
|
| -class BalloonPaintObserver : public RenderWidgetHost::PaintObserver {
|
| - public:
|
| - explicit BalloonPaintObserver(BalloonHost* balloon_host)
|
| - : balloon_host_(balloon_host) {
|
| - }
|
| -
|
| - virtual void RenderWidgetHostWillPaint(RenderWidgetHost* rhw) {}
|
| - virtual void RenderWidgetHostDidPaint(RenderWidgetHost* rwh);
|
| -
|
| - private:
|
| - BalloonHost* balloon_host_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(BalloonPaintObserver);
|
| -};
|
| -
|
| -void BalloonPaintObserver::RenderWidgetHostDidPaint(RenderWidgetHost* rwh) {
|
| - balloon_host_->RenderWidgetHostDidPaint();
|
| - // WARNING: we may have been deleted (if the balloon host cleared the paint
|
| - // observer).
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| BalloonHost::BalloonHost(Balloon* balloon)
|
| : render_view_host_(NULL),
|
| balloon_(balloon),
|
| @@ -236,7 +212,8 @@ void BalloonHost::Init() {
|
| rvh->set_view(render_widget_host_view());
|
| rvh->CreateRenderView(string16());
|
| #if defined(OS_MACOSX)
|
| - rvh->set_paint_observer(new BalloonPaintObserver(this));
|
| + registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT,
|
| + Source<RenderWidgetHost>(render_view_host));
|
| #endif
|
| rvh->NavigateToURL(balloon_->notification().content_url());
|
|
|
| @@ -259,10 +236,14 @@ void BalloonHost::ClearInspectorSettings() {
|
| RenderViewHostDelegateHelper::ClearInspectorSettings(GetProfile());
|
| }
|
|
|
| -void BalloonHost::RenderWidgetHostDidPaint() {
|
| - render_view_host_->set_paint_observer(NULL);
|
| - render_view_host_->EnablePreferredSizeChangedMode(
|
| - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
|
| +void BalloonHost::Observe(NotificationType type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details) {
|
| + if (type == NotificationType::RENDER_WIDGET_HOST_DID_PAINT) {
|
| + registrar_.RemoveAll();
|
| + render_view_host_->EnablePreferredSizeChangedMode(
|
| + kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
|
| + }
|
| }
|
|
|
| BalloonHost::~BalloonHost() {
|
|
|