Index: chrome/browser/ui/ash/chrome_shell_delegate.cc |
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc |
index 97d0fdd2d5d481702ded47b026b50a544710493e..258206697e238b03c3d77e831d8850a503a6f8d1 100644 |
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc |
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc |
@@ -107,12 +107,16 @@ content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { |
app_list::AppListViewDelegate* |
ChromeShellDelegate::CreateAppListViewDelegate() { |
DCHECK(ash::Shell::HasInstance()); |
- // Shell will own the created delegate, and the delegate will own |
- // the controller. |
- return new AppListViewDelegate( |
- Profile::FromBrowserContext(GetActiveBrowserContext()), |
- AppListService::Get(chrome::HOST_DESKTOP_TYPE_ASH)-> |
- GetControllerDelegate()); |
+ // Shell will own the created delegate (transitively via app list). |
+ // Ownership of the controller delegate remains with the AppListService. |
+ AppListControllerDelegate* controller_delegate = |
+ AppListService::Get(chrome::HOST_DESKTOP_TYPE_ASH) |
+ ->GetControllerDelegate(); |
+ AppListViewDelegate* view_delegate = |
+ new AppListViewDelegate(controller_delegate); |
+ view_delegate->SetProfile( |
+ Profile::FromBrowserContext(GetActiveBrowserContext())); |
+ return view_delegate; |
} |
ash::ShelfDelegate* ChromeShellDelegate::CreateShelfDelegate( |