Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: ui/app_list/views/contents_view.cc

Issue 164193005: Refactors the auto-launch logic and adds tests for it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win error 2 Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 425a1b7d1345c0c3cb7cb0e575c5be8ec0285fdf..1921aca0dc0872836b24e862c27610f887bd88ea 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -50,7 +50,6 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view,
AppListViewDelegate* view_delegate)
: show_state_(SHOW_APPS),
pagination_model_(pagination_model),
- view_delegate_(view_delegate),
view_model_(new views::ViewModel),
bounds_animator_(new views::BoundsAnimator(this)) {
DCHECK(model);
@@ -66,7 +65,7 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view,
view_model_->Add(apps_container_view_, kIndexAppsContainer);
SearchResultListView* search_results_view = new SearchResultListView(
- app_list_main_view);
+ app_list_main_view, view_delegate);
AddChildView(search_results_view);
view_model_->Add(search_results_view, kIndexSearchResults);
@@ -95,13 +94,12 @@ void ContentsView::SetShowState(ShowState show_state) {
}
void ContentsView::ShowStateChanged() {
- if (show_state_ == SHOW_SEARCH_RESULTS) {
- // TODO(xiyuan): Highlight default match instead of the first.
- SearchResultListView* results_view =
- GetSearchResultListView(view_model_.get());
- if (results_view->visible())
- results_view->SetSelectedIndex(0);
- }
+ 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();
AnimateToIdealBounds();
}
@@ -144,23 +142,12 @@ void ContentsView::AnimateToIdealBounds() {
void ContentsView::ShowSearchResults(bool show) {
SetShowState(show ? SHOW_SEARCH_RESULTS : SHOW_APPS);
- SearchResultListView* results_view =
- GetSearchResultListView(view_model_.get());
- if (show)
- results_view->SetAutoLaunchTimeout(view_delegate_->GetAutoLaunchTimeout());
- else
- results_view->CancelAutoLaunchTimeout();
}
void ContentsView::ShowFolderContent(AppListFolderItem* item) {
apps_container_view_->ShowActiveFolder(item);
}
-void ContentsView::CancelAutoLaunch() {
- GetSearchResultListView(view_model_.get())->CancelAutoLaunchTimeout();
- view_delegate_->AutoLaunchCanceled();
-}
-
void ContentsView::Prerender() {
const int selected_page = std::max(0, pagination_model_->selected_page());
apps_container_view_->apps_grid_view()->Prerender(selected_page);
@@ -183,7 +170,6 @@ void ContentsView::Layout() {
}
bool ContentsView::OnKeyPressed(const ui::KeyEvent& event) {
- CancelAutoLaunch();
switch (show_state_) {
case SHOW_APPS:
return GetAppsContainerView(view_model_.get())->OnKeyPressed(event);
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698