Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 433273002: NotificationObjectProxy should own the DesktopNotificationDelegateImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pass as scoped_ptr Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index eb459ede4b43bf2b77a7e3ef1ca8367f4166d185..b758ab26eda5a8831f11d0d639d6a21b77906b69 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -90,7 +90,6 @@ class DesktopNotificationDelegateImpl : public DesktopNotificationDelegate {
rfh->Send(new DesktopNotificationMsg_PostError(
rfh->GetRoutingID(), notification_id_));
- delete this;
}
virtual void NotificationClosed(bool by_user) OVERRIDE {
@@ -103,7 +102,6 @@ class DesktopNotificationDelegateImpl : public DesktopNotificationDelegate {
rfh->GetRoutingID(), notification_id_, by_user));
static_cast<RenderFrameHostImpl*>(rfh)->NotificationClosed(
notification_id_);
- delete this;
}
virtual void NotificationClick() OVERRIDE {
@@ -833,10 +831,14 @@ void RenderFrameHostImpl::OnRequestDesktopNotificationPermission(
void RenderFrameHostImpl::OnShowDesktopNotification(
int notification_id,
const ShowDesktopNotificationHostMsgParams& params) {
+ scoped_ptr<DesktopNotificationDelegateImpl> delegate(
+ new DesktopNotificationDelegateImpl(this, notification_id));
+
base::Closure cancel_callback;
GetContentClient()->browser()->ShowDesktopNotification(
- params, this,
- new DesktopNotificationDelegateImpl(this, notification_id),
+ params,
+ this,
+ delegate.PassAs<DesktopNotificationDelegate>(),
&cancel_callback);
cancel_notification_callbacks_[notification_id] = cancel_callback;
}
« no previous file with comments | « chrome/browser/notifications/notification_object_proxy.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698