Workaround for xkbcommon dead keys.
[chromium-blink-merge.git] / ui / app_list / views / search_result_list_view.h
blob7acf75e7bbf322e7890dc939fdb0bf2f6117785a
1 // Copyright (c) 2012 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_LIST_VIEW_H_
6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_LIST_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ui/app_list/views/search_result_container_view.h"
11 #include "ui/gfx/animation/animation_delegate.h"
12 #include "ui/views/view.h"
14 namespace gfx {
15 class LinearAnimation;
18 namespace app_list {
19 namespace test {
20 class SearchResultListViewTest;
23 class AppListViewDelegate;
24 class SearchResultListViewDelegate;
25 class SearchResultView;
27 // SearchResultListView displays SearchResultList with a list of
28 // SearchResultView.
29 class APP_LIST_EXPORT SearchResultListView : public gfx::AnimationDelegate,
30 public SearchResultContainerView {
31 public:
32 SearchResultListView(SearchResultListViewDelegate* delegate,
33 AppListViewDelegate* view_delegate);
34 ~SearchResultListView() override;
36 void UpdateAutoLaunchState();
38 bool IsResultViewSelected(const SearchResultView* result_view) const;
40 void SearchResultActivated(SearchResultView* view, int event_flags);
42 void SearchResultActionActivated(SearchResultView* view,
43 size_t action_index,
44 int event_flags);
46 void OnSearchResultInstalled(SearchResultView* view);
48 // Overridden from views::View:
49 bool OnKeyPressed(const ui::KeyEvent& event) override;
50 gfx::Size GetPreferredSize() const override;
52 // Overridden from ui::ListModelObserver:
53 void ListItemsRemoved(size_t start, size_t count) override;
55 // Overridden from SearchResultContainerView:
56 void OnContainerSelected(bool from_bottom) override;
58 private:
59 friend class test::SearchResultListViewTest;
61 // Overridden from SearchResultContainerView:
62 int Update() override;
63 void UpdateSelectedIndex(int old_selected, int new_selected) override;
65 // Updates the auto launch states.
66 void SetAutoLaunchTimeout(const base::TimeDelta& timeout);
67 void CancelAutoLaunchTimeout();
69 // Helper function to get SearchResultView at given |index|.
70 SearchResultView* GetResultViewAt(int index);
72 // Forcibly auto-launch for test if it is in auto-launching state.
73 void ForceAutoLaunchForTest();
75 // Overridden from views::View:
76 void Layout() override;
77 int GetHeightForWidth(int w) const override;
78 void VisibilityChanged(views::View* starting_from, bool is_visible) override;
80 // Overridden from gfx::AnimationDelegate:
81 void AnimationEnded(const gfx::Animation* animation) override;
82 void AnimationProgressed(const gfx::Animation* animation) override;
84 SearchResultListViewDelegate* delegate_; // Not owned.
85 AppListViewDelegate* view_delegate_; // Not owned.
87 views::View* results_container_;
88 views::View* auto_launch_indicator_;
89 scoped_ptr<gfx::LinearAnimation> auto_launch_animation_;
91 DISALLOW_COPY_AND_ASSIGN(SearchResultListView);
94 } // namespace app_list
96 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_LIST_VIEW_H_