1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_PAGE_VIEW_H_
6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_PAGE_VIEW_H_
10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h"
12 #include "ui/app_list/app_list_export.h"
13 #include "ui/app_list/app_list_model.h"
14 #include "ui/app_list/views/app_list_page.h"
15 #include "ui/app_list/views/search_result_container_view.h"
19 class AppListMainView
;
20 class AppListViewDelegate
;
22 // The start page for the experimental app list.
23 class APP_LIST_EXPORT SearchResultPageView
25 public SearchResultContainerView::Delegate
{
27 SearchResultPageView();
28 ~SearchResultPageView() override
;
30 int selected_index() { return selected_index_
; }
31 bool HasSelection() { return selected_index_
> -1; }
32 void SetSelection(bool select
); // Set or unset result selection.
34 void AddSearchResultContainerView(
35 AppListModel::SearchResults
* result_model
,
36 SearchResultContainerView
* result_container
);
38 const std::vector
<SearchResultContainerView
*>& result_container_views() {
39 return result_container_views_
;
42 // Overridden from views::View:
43 bool OnKeyPressed(const ui::KeyEvent
& event
) override
;
45 // AppListPage overrides:
46 gfx::Rect
GetPageBoundsForState(AppListModel::State state
) const override
;
47 void OnAnimationUpdated(double progress
,
48 AppListModel::State from_state
,
49 AppListModel::State to_state
) override
;
50 int GetSearchBoxZHeight() const override
;
51 void OnHidden() override
;
53 void ClearSelectedIndex();
55 // Overridden from SearchResultContainerView::Delegate :
56 void OnSearchResultContainerResultsChanged() override
;
59 // |directional_movement| is true if the navigation was caused by directional
60 // controls (eg, arrow keys), as opposed to linear controls (eg, Tab).
61 void SetSelectedIndex(int index
, bool directional_movement
);
62 bool IsValidSelectionIndex(int index
);
64 // The SearchResultContainerViews that compose the search page. All owned by
65 // the views hierarchy.
66 std::vector
<SearchResultContainerView
*> result_container_views_
;
68 // -1 indicates no selection.
71 DISALLOW_COPY_AND_ASSIGN(SearchResultPageView
);
74 } // namespace app_list
76 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_PAGE_VIEW_H_