Move ownership of the AppListViewDelegate into the AppListService
commit537b88b13b9aa406744db1f2681ec979d593d2e8
authortapted <tapted@chromium.org>
Fri, 19 Sep 2014 02:48:52 +0000 (18 19:48 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 19 Sep 2014 02:49:27 +0000 (19 02:49 +0000)
treeb3371546412f0b5c8614031bb2725902464c9a32
parent2dc910b0b9082050e5be6c81b00dddf97ffa3e6e
Move ownership of the AppListViewDelegate into the AppListService

It's currently hard for the AppListService to access the model. The
model is now profile keyed. However, to get the "right" profile, the
AppListViewDelegate is the current source of truth. And to get this,
AppListService needs to dig into its platform-specific parts to get it
via the platform-specific view.

However, the AppListView can be destroyed, so the delegate doesn't
always exist. Therefore the AppListViewDelegate doesn't always exist --
it is created each time the AppListView is created. On ChromeOS, this is
each time the app list is shown.

Before the model was profile-keyed, some state was tricky to store.
E.g., some is stored in ExtensionAppModelBuilder, and updated via
notifications (e.g. NOTIFICATION_APP_INSTALLED_TO_APPLIST). Also, since
the model must now outlive the AppListView for sync, it makes less sense
for the AppListViewDelegate to be owned by the view. Currently showing
the app list can create a new ALVD, which must be re-attached to the
model each time.

This change moves ownership of the AppListViewDelegate into the
AppListServiceIpml or test/shell controllers, which will create it
lazily and then cache the result.

BUG=403647, 404535

Review URL: https://codereview.chromium.org/508813002

Cr-Commit-Position: refs/heads/master@{#295646}
28 files changed:
ash/shell/shell_delegate_impl.cc
ash/shell/shell_delegate_impl.h
ash/shell_delegate.h
ash/test/test_shell_delegate.cc
ash/test/test_shell_delegate.h
ash/wm/app_list_controller.cc
chrome/browser/ui/app_list/app_list_service_impl.cc
chrome/browser/ui/app_list/app_list_service_impl.h
chrome/browser/ui/app_list/app_list_service_impl_browsertest.cc
chrome/browser/ui/app_list/app_list_service_mac.mm
chrome/browser/ui/app_list/app_list_service_unittest.cc
chrome/browser/ui/app_list/app_list_service_views.cc
chrome/browser/ui/app_list/app_list_service_views.h
chrome/browser/ui/app_list/app_list_shower_delegate.h
chrome/browser/ui/app_list/app_list_shower_views.cc
chrome/browser/ui/app_list/app_list_shower_views_unittest.cc
chrome/browser/ui/app_list/app_list_view_delegate.cc
chrome/browser/ui/app_list/app_list_view_delegate.h
chrome/browser/ui/ash/chrome_shell_delegate.cc
chrome/browser/ui/ash/chrome_shell_delegate.h
ui/app_list/cocoa/app_list_view_controller.h
ui/app_list/cocoa/app_list_view_controller.mm
ui/app_list/cocoa/app_list_view_controller_unittest.mm
ui/app_list/cocoa/app_list_window_controller_unittest.mm
ui/app_list/demo/app_list_demo_views.cc
ui/app_list/views/app_list_view.cc
ui/app_list/views/app_list_view.h
ui/app_list/views/app_list_view_unittest.cc