 Chromium Code Reviews
 Chromium Code Reviews Issue 439703002:
  Allow app list tiles to show search results in the experimental app list.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 439703002:
  Allow app list tiles to show search results in the experimental app list.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: ui/app_list/views/start_page_view.h | 
| diff --git a/ui/app_list/views/start_page_view.h b/ui/app_list/views/start_page_view.h | 
| index b429f8b7fd9979e1246f819d69224ff129986d59..6a04693fdc5d9e8a7df940968bcd1ba9373db5c5 100644 | 
| --- a/ui/app_list/views/start_page_view.h | 
| +++ b/ui/app_list/views/start_page_view.h | 
| @@ -6,24 +6,29 @@ | 
| #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ | 
| #include "base/basictypes.h" | 
| -#include "ui/app_list/app_list_model_observer.h" | 
| +#include "base/memory/weak_ptr.h" | 
| +#include "ui/app_list/app_list_export.h" | 
| +#include "ui/app_list/app_list_model.h" | 
| #include "ui/app_list/app_list_view_delegate_observer.h" | 
| #include "ui/app_list/views/search_box_view_delegate.h" | 
| +#include "ui/base/models/list_model_observer.h" | 
| #include "ui/views/view.h" | 
| namespace app_list { | 
| +namespace test { | 
| +class AppListViewTestContext; | 
| +} | 
| class AppListMainView; | 
| -class AppListModel; | 
| class AppListViewDelegate; | 
| class SearchResultListView; | 
| class TileItemView; | 
| // The start page for the experimental app list. | 
| -class StartPageView : public views::View, | 
| - public SearchBoxViewDelegate, | 
| - public AppListViewDelegateObserver, | 
| - public AppListModelObserver { | 
| +class APP_LIST_EXPORT StartPageView : public views::View, | 
| + public ui::ListModelObserver, | 
| + public SearchBoxViewDelegate, | 
| + public AppListViewDelegateObserver { | 
| public: | 
| StartPageView(AppListMainView* app_list_main_view, | 
| AppListViewDelegate* view_delegate); | 
| @@ -42,6 +47,8 @@ class StartPageView : public views::View, | 
| virtual void Layout() OVERRIDE; | 
| private: | 
| + friend class test::AppListViewTestContext; | 
| 
Matt Giuca
2014/08/14 02:54:22
As discussed, instead of friending, add a public m
 
calamity
2014/08/14 04:28:05
Done.
 | 
| + | 
| enum ShowState { | 
| SHOW_START_PAGE, | 
| SHOW_SEARCH_RESULTS, | 
| @@ -53,22 +60,30 @@ class StartPageView : public views::View, | 
| void SetShowState(ShowState show_state); | 
| void SetModel(AppListModel* model); | 
| + // Updates UI with model. | 
| + void Update(); | 
| + | 
| + // Schedules an Update() call using |update_factory_|. Does nothing if there | 
| + // is a pending call. | 
| + void ScheduleUpdate(); | 
| + | 
| // Overridden from SearchBoxViewDelegate: | 
| virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; | 
| // Overridden from AppListViewDelegateObserver: | 
| virtual void OnProfilesChanged() OVERRIDE; | 
| - // Overridden from AppListModelObserver: | 
| - virtual void OnAppListModelStatusChanged() OVERRIDE; | 
| - virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE; | 
| - virtual void OnAppListItemDeleted() OVERRIDE; | 
| - virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE; | 
| + // Overridden from ui::ListModelObserver: | 
| + virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; | 
| + virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; | 
| + virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; | 
| + virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; | 
| // The parent view of ContentsView which is the parent of this view. | 
| AppListMainView* app_list_main_view_; | 
| - AppListModel* model_; // Owned by AppListSyncableService. | 
| + AppListModel::SearchResults* | 
| + search_results_model_; // Owned by AppListSyncableService. | 
| AppListViewDelegate* view_delegate_; // Owned by AppListView. | 
| @@ -81,6 +96,11 @@ class StartPageView : public views::View, | 
| ShowState show_state_; | 
| + // ScheduleUpdate() generates a single weak pointer; if one exists then an | 
| + // update is pending. Further calls to ScheduleUpdate() will have no effect. | 
| + // Once the Update() completes, the weak pointer is invalidated. | 
| + base::WeakPtrFactory<StartPageView> update_factory_; | 
| + | 
| DISALLOW_COPY_AND_ASSIGN(StartPageView); | 
| }; |