diff options
author | tapted <tapted@chromium.org> | 2014-09-18 19:48:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-19 02:49:27 +0000 |
commit | 537b88b13b9aa406744db1f2681ec979d593d2e8 (patch) | |
tree | b3371546412f0b5c8614031bb2725902464c9a32 /ash/shell_delegate.h | |
parent | 2dc910b0b9082050e5be6c81b00dddf97ffa3e6e (diff) | |
download | chromium_src-537b88b13b9aa406744db1f2681ec979d593d2e8.zip chromium_src-537b88b13b9aa406744db1f2681ec979d593d2e8.tar.gz chromium_src-537b88b13b9aa406744db1f2681ec979d593d2e8.tar.bz2 |
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}
Diffstat (limited to 'ash/shell_delegate.h')
-rw-r--r-- | ash/shell_delegate.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index d41132b..148f686 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -111,9 +111,9 @@ class ASH_EXPORT ShellDelegate { // in chrome. virtual content::BrowserContext* GetActiveBrowserContext() = 0; - // Invoked to create an AppListViewDelegate. Shell takes the ownership of - // the created delegate. - virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0; + // Get the AppListViewDelegate, creating one if it does not yet exist. + // Ownership stays with Chrome's AppListService, or the ShellDelegate. + virtual app_list::AppListViewDelegate* GetAppListViewDelegate() = 0; // Creates a new ShelfDelegate. Shell takes ownership of the returned // value. |