| Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
|
| diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
|
| index b86d5cafd6ca1863e3c9e8faa02cf1091513702a..7b766f1afdb589f40e6ef03134de7adfeedd3e0c 100644
|
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
|
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
|
| @@ -190,7 +190,7 @@ void ChromeLauncherControllerUserSwitchObserver::AddUser(Profile* profile) {
|
| ChromeLauncherControllerImpl::ChromeLauncherControllerImpl(
|
| Profile* profile,
|
| ash::ShelfModel* model)
|
| - : model_(model), profile_(profile) {
|
| + : model_(model), profile_(profile), weak_ptr_factory_(this) {
|
| DCHECK(model_);
|
| if (!profile_) {
|
| // If no profile was passed, we take the currently active profile and use it
|
| @@ -1180,7 +1180,7 @@ void ChromeLauncherControllerImpl::ScheduleUpdateAppLaunchersFromPref() {
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE,
|
| base::Bind(&ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() {
|
| @@ -1524,7 +1524,7 @@ void ChromeLauncherControllerImpl::AttachProfile(Profile* profile) {
|
| pref_change_registrar_.Add(
|
| prefs::kPolicyPinnedLauncherApps,
|
| base::Bind(&ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| // Handling of prefs::kArcEnabled change should be called deferred to avoid
|
| // race condition when OnAppUninstalledPrepared for Arc apps is called after
|
| // UpdateAppLaunchersFromPref.
|
| @@ -1532,25 +1532,25 @@ void ChromeLauncherControllerImpl::AttachProfile(Profile* profile) {
|
| prefs::kArcEnabled,
|
| base::Bind(
|
| &ChromeLauncherControllerImpl::ScheduleUpdateAppLaunchersFromPref,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| pref_change_registrar_.Add(
|
| prefs::kShelfAlignmentLocal,
|
| base::Bind(&ChromeLauncherControllerImpl::SetShelfAlignmentFromPrefs,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| pref_change_registrar_.Add(
|
| prefs::kShelfAutoHideBehaviorLocal,
|
| base::Bind(
|
| &ChromeLauncherControllerImpl::SetShelfAutoHideBehaviorFromPrefs,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| pref_change_registrar_.Add(
|
| prefs::kShelfPreferences,
|
| base::Bind(&ChromeLauncherControllerImpl::SetShelfBehaviorsFromPrefs,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| pref_change_registrar_.Add(
|
| prefs::kTouchVirtualKeyboardEnabled,
|
| base::Bind(
|
| &ChromeLauncherControllerImpl::SetVirtualKeyboardBehaviorFromPrefs,
|
| - base::Unretained(this)));
|
| + weak_ptr_factory_.GetWeakPtr()));
|
|
|
| std::unique_ptr<LauncherAppUpdater> extension_app_updater(
|
| new LauncherExtensionAppUpdater(this, profile_));
|
|
|