Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / app_list / views / search_result_list_view.h
blobdf02647aa47638634f9a7a940da1817b5c77ae86
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,
57 bool directional_movement) override;
59 private:
60 friend class test::SearchResultListViewTest;
62 // Overridden from SearchResultContainerView:
63 int Update() override;
64 void UpdateSelectedIndex(int old_selected, int new_selected) override;
66 // Updates the auto launch states.
67 void SetAutoLaunchTimeout(const base::TimeDelta& timeout);
68 void CancelAutoLaunchTimeout();
70 // Helper function to get SearchResultView at given |index|.
71 SearchResultView* GetResultViewAt(int index);
73 // Forcibly auto-launch for test if it is in auto-launching state.
74 void ForceAutoLaunchForTest();
76 // Overridden from views::View:
77 void Layout() override;
78 int GetHeightForWidth(int w) const override;
79 void VisibilityChanged(views::View* starting_from, bool is_visible) override;
81 // Overridden from gfx::AnimationDelegate:
82 void AnimationEnded(const gfx::Animation* animation) override;
83 void AnimationProgressed(const gfx::Animation* animation) override;
85 SearchResultListViewDelegate* delegate_; // Not owned.
86 AppListViewDelegate* view_delegate_; // Not owned.
88 views::View* results_container_;
89 views::View* auto_launch_indicator_;
90 scoped_ptr<gfx::LinearAnimation> auto_launch_animation_;
92 DISALLOW_COPY_AND_ASSIGN(SearchResultListView);
95 } // namespace app_list
97 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_LIST_VIEW_H_