| Index: chrome/browser/automation/testing_automation_provider_views.cc
|
| diff --git a/chrome/browser/automation/testing_automation_provider_views.cc b/chrome/browser/automation/testing_automation_provider_views.cc
|
| index 40af25bee2f3f2660007ffa46dfdede39d177bef..9a02bb00c4a68bfe349cb456155c57a786fc535e 100644
|
| --- a/chrome/browser/automation/testing_automation_provider_views.cc
|
| +++ b/chrome/browser/automation/testing_automation_provider_views.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/automation/testing_automation_provider.h"
|
|
|
| +#include "base/bind.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/compiler_specific.h"
|
| #include "chrome/browser/automation/automation_browser_tracker.h"
|
| #include "chrome/browser/automation/automation_window_tracker.h"
|
| @@ -30,7 +32,7 @@ class ViewFocusChangeWaiter : public views::FocusChangeListener {
|
| previous_view_id_(previous_view_id),
|
| automation_(automation),
|
| reply_message_(reply_message),
|
| - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
|
| + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
|
| focus_manager_->AddFocusChangeListener(this);
|
| // Call the focus change notification once in case the focus has
|
| // already changed.
|
| @@ -48,10 +50,8 @@ class ViewFocusChangeWaiter : public views::FocusChangeListener {
|
| // that will get run after focus changes.
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - method_factory_.NewRunnableMethod(
|
| - &ViewFocusChangeWaiter::FocusChanged,
|
| - focused_before,
|
| - focused_now));
|
| + base::Bind(&ViewFocusChangeWaiter::FocusChanged,
|
| + weak_factory_.GetWeakPtr(), focused_before, focused_now));
|
| }
|
|
|
| private:
|
| @@ -70,7 +70,7 @@ class ViewFocusChangeWaiter : public views::FocusChangeListener {
|
| int previous_view_id_;
|
| AutomationProvider* automation_;
|
| IPC::Message* reply_message_;
|
| - ScopedRunnableMethodFactory<ViewFocusChangeWaiter> method_factory_;
|
| + base::WeakPtrFactory<ViewFocusChangeWaiter> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ViewFocusChangeWaiter);
|
| };
|
|
|