Chromium Code Reviews| Index: chrome/browser/external_tab_container_win.cc |
| =================================================================== |
| --- chrome/browser/external_tab_container_win.cc (revision 111241) |
| +++ chrome/browser/external_tab_container_win.cc (working copy) |
| @@ -6,6 +6,7 @@ |
| #include <string> |
| +#include "base/bind.h" |
| #include "base/debug/trace_event.h" |
| #include "base/i18n/rtl.h" |
| #include "base/logging.h" |
| @@ -102,7 +103,7 @@ |
| automation_resource_message_filter_(filter), |
| load_requests_via_automation_(false), |
| handle_top_level_requests_(false), |
| - external_method_factory_(this), |
| + weak_factory_(this), |
|
James Hawkins
2011/11/23 18:09:51
ALLOW_THIS_... for consistency across the code bas
csilv
2011/11/23 18:35:36
Done.
|
| pending_(false), |
| focus_manager_(NULL), |
| external_tab_view_(NULL), |
| @@ -198,8 +199,8 @@ |
| // Navigate out of context since we don't have a 'tab_handle_' yet. |
| MessageLoop::current()->PostTask( |
| FROM_HERE, |
| - external_method_factory_.NewRunnableMethod( |
| - &ExternalTabContainer::Navigate, initial_url, referrer)); |
| + base::Bind(&ExternalTabContainer::Navigate, weak_factory_.GetWeakPtr(), |
| + initial_url, referrer)); |
| } |
| // We need WS_POPUP to be on the window during initialization, but |
| @@ -262,9 +263,8 @@ |
| // Wait for the automation channel to be initialized before resuming pending |
| // render views and sending in the navigation state. |
| MessageLoop::current()->PostTask( |
| - FROM_HERE, |
| - external_method_factory_.NewRunnableMethod( |
| - &ExternalTabContainer::OnReinitialize)); |
| + FROM_HERE, base::Bind(&ExternalTabContainer::OnReinitialize, |
| + weak_factory_.GetWeakPtr())); |
| if (parent_window) |
| SetParent(GetNativeView(), parent_window); |
| @@ -542,10 +542,12 @@ |
| // In case the host needs to show UI that needs to take the focus. |
| ::AllowSetForegroundWindow(ASFW_ANY); |
| - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| - NewRunnableMethod(automation_resource_message_filter_.get(), |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
| + base::Bind( |
| &AutomationResourceMessageFilter::SendDownloadRequestToHost, |
| - 0, tab_handle_, request_id)); |
| + automation_resource_message_filter_.get(), 0, tab_handle_, |
| + request_id)); |
| } |
| } else { |
| DLOG(WARNING) << "Downloads are only supported with host browser network " |