| Index: ui/app_list/views/start_page_view.cc | 
| diff --git a/ui/app_list/views/start_page_view.cc b/ui/app_list/views/start_page_view.cc | 
| index affdc2d938ed7cd9917ce68b5a6c0941516732da..374e9fcf35b81f5720cb7773758df4a5afe761a6 100644 | 
| --- a/ui/app_list/views/start_page_view.cc | 
| +++ b/ui/app_list/views/start_page_view.cc | 
| @@ -9,6 +9,7 @@ | 
| #include "ui/app_list/app_list_item.h" | 
| #include "ui/app_list/app_list_model.h" | 
| #include "ui/app_list/app_list_view_delegate.h" | 
| +#include "ui/app_list/search_result.h" | 
| #include "ui/app_list/views/app_list_main_view.h" | 
| #include "ui/app_list/views/search_box_view.h" | 
| #include "ui/app_list/views/search_result_list_view.h" | 
| @@ -95,14 +96,15 @@ class DummySearchBoxView : public SearchBoxView { | 
| StartPageView::StartPageView(AppListMainView* app_list_main_view, | 
| AppListViewDelegate* view_delegate) | 
| : app_list_main_view_(app_list_main_view), | 
| -      model_(NULL), | 
| +      search_results_model_(NULL), | 
| view_delegate_(view_delegate), | 
| search_box_view_(new DummySearchBoxView(this, view_delegate_)), | 
| results_view_( | 
| new SearchResultListView(app_list_main_view, view_delegate)), | 
| instant_container_(new views::View), | 
| tiles_container_(new views::View), | 
| -      show_state_(SHOW_START_PAGE) { | 
| +      show_state_(SHOW_START_PAGE), | 
| +      update_factory_(this) { | 
| // The view containing the start page WebContents and DummySearchBoxView. | 
| InitInstantContainer(); | 
| AddChildView(instant_container_); | 
| @@ -120,8 +122,8 @@ StartPageView::StartPageView(AppListMainView* app_list_main_view, | 
|  | 
| StartPageView::~StartPageView() { | 
| view_delegate_->RemoveObserver(this); | 
| -  if (model_) | 
| -    model_->RemoveObserver(this); | 
| +  if (search_results_model_) | 
| +    search_results_model_->RemoveObserver(this); | 
| } | 
|  | 
| void StartPageView::InitInstantContainer() { | 
| @@ -168,29 +170,22 @@ void StartPageView::InitTilesContainer() { | 
|  | 
| void StartPageView::SetModel(AppListModel* model) { | 
| DCHECK(model); | 
| -  if (model_) | 
| -    model_->RemoveObserver(this); | 
| -  model_ = model; | 
| -  model_->AddObserver(this); | 
| -  results_view_->SetResults(model_->results()); | 
| +  if (search_results_model_) | 
| +    search_results_model_->RemoveObserver(this); | 
| +  search_results_model_ = model->results(); | 
| +  search_results_model_->AddObserver(this); | 
| +  results_view_->SetResults(search_results_model_); | 
| Reset(); | 
| } | 
|  | 
| void StartPageView::Reset() { | 
| SetShowState(SHOW_START_PAGE); | 
| -  if (!model_ || !model_->top_level_item_list()) | 
| -    return; | 
| - | 
| -  for (size_t i = 0; i < kNumStartPageTiles; ++i) { | 
| -    AppListItem* item = NULL; | 
| -    if (i < model_->top_level_item_list()->item_count()) | 
| -      item = model_->top_level_item_list()->item_at(i); | 
| -    tile_views_[i]->SetAppListItem(item); | 
| -  } | 
| +  Update(); | 
| } | 
|  | 
| void StartPageView::ShowSearchResults() { | 
| SetShowState(SHOW_SEARCH_RESULTS); | 
| +  Update(); | 
| } | 
|  | 
| void StartPageView::SetShowState(ShowState show_state) { | 
| @@ -207,6 +202,9 @@ void StartPageView::SetShowState(ShowState show_state) { | 
|  | 
| show_state_ = show_state; | 
|  | 
| +  if (show_state_ == SHOW_START_PAGE) | 
| +    search_box_view_->ClearSearch(); | 
| + | 
| results_view_->UpdateAutoLaunchState(); | 
| if (show_state == SHOW_SEARCH_RESULTS) | 
| results_view_->SetSelectedIndex(0); | 
| @@ -236,6 +234,32 @@ void StartPageView::Layout() { | 
| tiles_container_->SetBoundsRect(bounds); | 
| } | 
|  | 
| +void StartPageView::Update() { | 
| +  std::vector<SearchResult*> display_results = | 
| +      AppListModel::FilterSearchResultsByDisplayType(search_results_model_, | 
| +                                                     SearchResult::DISPLAY_TILE, | 
| +                                                     kNumStartPageTiles); | 
| +  for (size_t i = 0; i < kNumStartPageTiles; ++i) { | 
| +    SearchResult* item = NULL; | 
| +    if (i < display_results.size()) | 
| +      item = display_results[i]; | 
| +    tile_views_[i]->SetSearchResult(item); | 
| +  } | 
| +  tiles_container_->Layout(); | 
| +  Layout(); | 
| +  update_factory_.InvalidateWeakPtrs(); | 
| +} | 
| + | 
| +void StartPageView::ScheduleUpdate() { | 
| +  // When search results are added one by one, each addition generates an update | 
| +  // request. Consolidates those update requests into one Update call. | 
| +  if (!update_factory_.HasWeakPtrs()) { | 
| +    base::MessageLoop::current()->PostTask( | 
| +        FROM_HERE, | 
| +        base::Bind(&StartPageView::Update, update_factory_.GetWeakPtr())); | 
| +  } | 
| +} | 
| + | 
| void StartPageView::QueryChanged(SearchBoxView* sender) { | 
| // Forward the search terms on to the real search box and clear the dummy | 
| // search box. | 
| @@ -248,20 +272,20 @@ void StartPageView::OnProfilesChanged() { | 
| SetModel(view_delegate_->GetModel()); | 
| } | 
|  | 
| -void StartPageView::OnAppListModelStatusChanged() { | 
| -  Reset(); | 
| +void StartPageView::ListItemsAdded(size_t start, size_t count) { | 
| +  ScheduleUpdate(); | 
| } | 
|  | 
| -void StartPageView::OnAppListItemAdded(AppListItem* item) { | 
| -  Reset(); | 
| +void StartPageView::ListItemsRemoved(size_t start, size_t count) { | 
| +  ScheduleUpdate(); | 
| } | 
|  | 
| -void StartPageView::OnAppListItemDeleted() { | 
| -  Reset(); | 
| +void StartPageView::ListItemMoved(size_t index, size_t target_index) { | 
| +  ScheduleUpdate(); | 
| } | 
|  | 
| -void StartPageView::OnAppListItemUpdated(AppListItem* item) { | 
| -  Reset(); | 
| +void StartPageView::ListItemsChanged(size_t start, size_t count) { | 
| +  ScheduleUpdate(); | 
| } | 
|  | 
| }  // namespace app_list | 
|  |