diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 05:21:04 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 05:21:04 +0000 |
commit | 662b592e04ddcbd7e3e5c3dc7fe09d20852bc8ad (patch) | |
tree | a1854f7e4bdf5b15c40c8a77cd9fd685c625b4f6 /ash/shell/app_list.cc | |
parent | ccf17255c487be73a69c5b45bee7546eb0a03999 (diff) | |
download | chromium_src-662b592e04ddcbd7e3e5c3dc7fe09d20852bc8ad.zip chromium_src-662b592e04ddcbd7e3e5c3dc7fe09d20852bc8ad.tar.gz chromium_src-662b592e04ddcbd7e3e5c3dc7fe09d20852bc8ad.tar.bz2 |
ash: Open app list and highlight the installed app.
- Add a NOTIFICATION_APP_INSTALLED_TO_APPLIST similar to
NOTIFICATION_APP_INSTALLED_TO_NTP;
- OpenAppInstalledNTP -> OpenAppInstalledUI, which opens applist on ash and
fires NOTIFICATION_APP_INSTALLED_TO_APPLIST;
- Make AppListModelBuilder observes extension loading/unloading and
NOTIFICATION_APP_INSTALLED_TO_APPLIST and updates model accordingly;
- Make AppListView SetModel on its delegate explicitly;
- Make AppListViewDelegate hosts a builder as its member and pass the model
used by app list to the builder;
BUG=117087
TEST=Install an app and app list should open and highlight the installed app.
Review URL: http://codereview.chromium.org/9700066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell/app_list.cc')
-rw-r--r-- | ash/shell/app_list.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index f4f8bd6..80ff70e 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -106,12 +106,17 @@ class WindowTypeLauncherItem : public ash::AppListItemModel { class ExampleAppListViewDelegate : public ash::AppListViewDelegate { public: - ExampleAppListViewDelegate() {} + ExampleAppListViewDelegate() : model_(NULL) {} private: // Overridden from ash::AppListViewDelegate: - virtual void BuildAppListModel(const std::string& query, - AppListModel* model) OVERRIDE { + virtual void SetModel(AppListModel* model) OVERRIDE { + model_ = model; + } + + virtual void UpdateModel(const std::string& query) OVERRIDE { + DCHECK(model_ && model_->item_count() == 0); + for (int i = 0; i < static_cast<int>(WindowTypeLauncherItem::LAST_TYPE); ++i) { @@ -120,7 +125,7 @@ class ExampleAppListViewDelegate : public ash::AppListViewDelegate { std::string title = WindowTypeLauncherItem::GetTitle(type); if (title.find(query) != std::string::npos) - model->AddItem(new WindowTypeLauncherItem(type)); + model_->AddItem(new WindowTypeLauncherItem(type)); } } @@ -129,6 +134,8 @@ class ExampleAppListViewDelegate : public ash::AppListViewDelegate { static_cast<WindowTypeLauncherItem*>(item)->Activate(event_flags); } + AppListModel* model_; + DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); }; |