Commit 021c18bc authored by mukai@chromium.org's avatar mukai@chromium.org

Uses WeakPtrFactory instead of base::Unretained.

Although TrayIME removes the notification, the callback notification
delegate may survive due to complicated ref-counted-ness of
NotificationDelegate.

Anyways WeakPtr would be better here rather than Unretained.

BUG=336650
R=stevenjb@chromium.org, dewittj@chromium.org
TEST=None

Review URL: https://codereview.chromium.org/138833004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248577 0039d316-1c4b-4281-b951-d872f2087c98
parent a4241191
......@@ -190,7 +190,8 @@ TrayIME::TrayIME(SystemTray* system_tray)
tray_label_(NULL),
default_(NULL),
detailed_(NULL),
message_shown_(false) {
message_shown_(false),
weak_factory_(this) {
Shell::GetInstance()->system_tray_notifier()->AddIMEObserver(this);
}
......@@ -243,7 +244,7 @@ void TrayIME::UpdateOrCreateNotification() {
message_center::RichNotificationData(),
new message_center::HandleNotificationClickedDelegate(
base::Bind(&TrayIME::PopupDetailedView,
base::Unretained(this), 0, true))));
weak_factory_.GetWeakPtr(), 0, true))));
message_center->AddNotification(notification.Pass());
message_shown_ = true;
}
......
......@@ -7,6 +7,7 @@
#include "ash/system/ime/ime_observer.h"
#include "ash/system/tray/system_tray_item.h"
#include "base/memory/weak_ptr.h"
namespace views {
class Label;
......@@ -61,6 +62,8 @@ class TrayIME : public SystemTrayItem,
bool message_shown_;
base::WeakPtrFactory<TrayIME> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TrayIME);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment