diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 21:24:37 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 21:24:37 +0000 |
commit | 6198f7989a5140e9f3b7717138c2f25527ffa8f2 (patch) | |
tree | 0e722c6d0e3bf4022d5a6b5d79ba2b63ac543e68 /chrome/browser/ui/browser_init.cc | |
parent | da910fe462244967d8a23e6b9e5532a293800d48 (diff) | |
download | chromium_src-6198f7989a5140e9f3b7717138c2f25527ffa8f2.zip chromium_src-6198f7989a5140e9f3b7717138c2f25527ffa8f2.tar.gz chromium_src-6198f7989a5140e9f3b7717138c2f25527ffa8f2.tar.bz2 |
base::Bind migrations in chrome/browser
BUG=none
Review URL: http://codereview.chromium.org/8513020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_init.cc')
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 8ad86e6..3b6645c 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -6,11 +6,14 @@ #include <algorithm> // For max(). +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/compiler_specific.h" #include "base/environment.h" #include "base/event_recorder.h" #include "base/file_path.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/string_number_conversions.h" @@ -171,7 +174,7 @@ class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { bool should_expire_; // Used to delay the expiration of the info-bar. - ScopedRunnableMethodFactory<DefaultBrowserInfoBarDelegate> method_factory_; + base::WeakPtrFactory<DefaultBrowserInfoBarDelegate> weak_factory_; DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); }; @@ -183,12 +186,13 @@ DefaultBrowserInfoBarDelegate::DefaultBrowserInfoBarDelegate( prefs_(prefs), action_taken_(false), should_expire_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { // We want the info-bar to stick-around for few seconds and then be hidden // on the next navigation after that. - MessageLoop::current()->PostDelayedTask(FROM_HERE, - method_factory_.NewRunnableMethod( - &DefaultBrowserInfoBarDelegate::AllowExpiry), 8000); // 8 seconds. + MessageLoop::current()->PostDelayedTask( + FROM_HERE, base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, + weak_factory_.GetWeakPtr()), + 8000); // 8 seconds. } DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { @@ -1331,8 +1335,9 @@ void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { if (g_browser_process->local_state()->GetBoolean( prefs::kDefaultBrowserSettingEnabled)) { BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, NewRunnableFunction( - &ShellIntegration::SetAsDefaultBrowser)); + BrowserThread::FILE, FROM_HERE, + base::IgnoreReturn<bool>( + base::Bind(&ShellIntegration::SetAsDefaultBrowser))); } else { // TODO(pastarmovj): We can't really do anything meaningful here yet but // just prevent showing the infobar. |