| Index: ui/app_list/views/contents_view.cc
|
| diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc
|
| index a05516866a85c60aa80cc196e873d3f1eccd6689..0fcea771c37c7c3536ba50a0377e34205c5a9ea5 100644
|
| --- a/ui/app_list/views/contents_view.cc
|
| +++ b/ui/app_list/views/contents_view.cc
|
| @@ -37,19 +37,6 @@ const int kMinHorizVelocityToSwitchPage = 800;
|
|
|
| const double kFinishTransitionThreshold = 0.33;
|
|
|
| -AppsContainerView* GetAppsContainerView(views::ViewModel* model) {
|
| - return static_cast<AppsContainerView*>(model->view_at(kIndexAppsContainer));
|
| -}
|
| -
|
| -SearchResultListView* GetSearchResultListView(views::ViewModel* model) {
|
| - return static_cast<SearchResultListView*>(
|
| - model->view_at(kIndexSearchResults));
|
| -}
|
| -
|
| -StartPageView* GetStartPageView(views::ViewModel* model) {
|
| - return static_cast<StartPageView*>(model->view_at(kIndexStartPage));
|
| -}
|
| -
|
| } // namespace
|
|
|
| ContentsView::ContentsView(AppListMainView* app_list_main_view,
|
| @@ -66,10 +53,10 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view,
|
| AddChildView(apps_container_view_);
|
| view_model_->Add(apps_container_view_, kIndexAppsContainer);
|
|
|
| - SearchResultListView* search_results_view = new SearchResultListView(
|
| - app_list_main_view, view_delegate);
|
| - AddChildView(search_results_view);
|
| - view_model_->Add(search_results_view, kIndexSearchResults);
|
| + search_results_view_ =
|
| + new SearchResultListView(app_list_main_view, view_delegate);
|
| + AddChildView(search_results_view_);
|
| + view_model_->Add(search_results_view_, kIndexSearchResults);
|
|
|
| if (app_list::switches::IsExperimentalAppListEnabled()) {
|
| start_page_view_ = new StartPageView(app_list_main_view, view_delegate);
|
| @@ -77,7 +64,7 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view,
|
| view_model_->Add(start_page_view_, kIndexStartPage);
|
| }
|
|
|
| - GetSearchResultListView(view_model_.get())->SetResults(model->results());
|
| + search_results_view_->SetResults(model->results());
|
| }
|
|
|
| ContentsView::~ContentsView() {
|
| @@ -108,18 +95,16 @@ void ContentsView::SetShowState(ShowState show_state) {
|
| }
|
|
|
| void ContentsView::ShowStateChanged() {
|
| - SearchResultListView* results_view =
|
| - GetSearchResultListView(view_model_.get());
|
| // TODO(xiyuan): Highlight default match instead of the first.
|
| - if (show_state_ == SHOW_SEARCH_RESULTS && results_view->visible())
|
| - results_view->SetSelectedIndex(0);
|
| - results_view->UpdateAutoLaunchState();
|
| + if (show_state_ == SHOW_SEARCH_RESULTS && search_results_view_->visible())
|
| + search_results_view_->SetSelectedIndex(0);
|
| + search_results_view_->UpdateAutoLaunchState();
|
|
|
| // Notify parent AppListMainView of show state change.
|
| app_list_main_view_->OnContentsViewShowStateChanged();
|
|
|
| if (show_state_ == SHOW_START_PAGE)
|
| - GetStartPageView(view_model_.get())->Reset();
|
| + start_page_view_->Reset();
|
|
|
| AnimateToIdealBounds();
|
| }
|
| @@ -207,10 +192,9 @@ void ContentsView::Prerender() {
|
| }
|
|
|
| gfx::Size ContentsView::GetPreferredSize() const {
|
| - const gfx::Size container_size = GetAppsContainerView(view_model_.get())->
|
| - apps_grid_view()->GetPreferredSize();
|
| - const gfx::Size results_size =
|
| - GetSearchResultListView(view_model_.get())->GetPreferredSize();
|
| + const gfx::Size container_size =
|
| + apps_container_view_->apps_grid_view()->GetPreferredSize();
|
| + const gfx::Size results_size = search_results_view_->GetPreferredSize();
|
|
|
| int width = std::max(container_size.width(), results_size.width());
|
| int height = std::max(container_size.height(), results_size.height());
|
| @@ -225,11 +209,11 @@ void ContentsView::Layout() {
|
| bool ContentsView::OnKeyPressed(const ui::KeyEvent& event) {
|
| switch (show_state_) {
|
| case SHOW_APPS:
|
| - return GetAppsContainerView(view_model_.get())->OnKeyPressed(event);
|
| + return apps_container_view_->OnKeyPressed(event);
|
| case SHOW_SEARCH_RESULTS:
|
| - return GetSearchResultListView(view_model_.get())->OnKeyPressed(event);
|
| + return search_results_view_->OnKeyPressed(event);
|
| case SHOW_START_PAGE:
|
| - return GetStartPageView(view_model_.get())->OnKeyPressed(event);
|
| + return start_page_view_->OnKeyPressed(event);
|
| default:
|
| NOTREACHED() << "Unknown show state " << show_state_;
|
| }
|
|
|