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

Side by Side Diff: ui/app_list/search_result_list_view.h

Issue 11784034: Skeleton for app_list on OSX, and refactoring for enable_app_list=1 on OS=="mac". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for 175876 and 175961 Created 7 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/app_list/search_box_view.cc ('k') | ui/app_list/search_result_list_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef UI_APP_LIST_SEARCH_RESULT_LIST_VIEW_H_
6 #define UI_APP_LIST_SEARCH_RESULT_LIST_VIEW_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ui/app_list/app_list_model.h"
11 #include "ui/app_list/search_result_view_delegate.h"
12 #include "ui/base/models/list_model_observer.h"
13 #include "ui/views/view.h"
14
15 namespace app_list {
16
17 class SearchResultListViewDelegate;
18 class SearchResultView;
19
20 // SearchResultListView displays AppListModel::SearchResults with a list of
21 // SearchResultView.
22 class SearchResultListView : public views::View,
23 public ui::ListModelObserver,
24 public SearchResultViewDelegate {
25 public:
26 explicit SearchResultListView(SearchResultListViewDelegate* delegate);
27 virtual ~SearchResultListView();
28
29 void SetResults(AppListModel::SearchResults* results);
30
31 void SetSelectedIndex(int selected_index);
32
33 bool IsResultViewSelected(const SearchResultView* result_view) const;
34
35 // Overridden from views::View:
36 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
37
38 private:
39 // Helper function to get SearchResultView at given |index|.
40 SearchResultView* GetResultViewAt(int index);
41
42 // Updates UI with model.
43 void Update();
44
45 // Schedules an Update call using |update_factory_|. Do nothing if there is a
46 // pending call.
47 void ScheduleUpdate();
48
49 // Overridden from ListModelObserver:
50 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
51 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
52 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE;
53 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE;
54
55 // Overridden from SearchResultViewDelegate:
56 virtual void SearchResultActivated(SearchResultView* view,
57 const ui::Event& event) OVERRIDE;
58 virtual void SearchResultActionActivated(SearchResultView* view,
59 int action_index,
60 const ui::Event& event) OVERRIDE;
61
62 SearchResultListViewDelegate* delegate_; // Not owned.
63 AppListModel::SearchResults* results_; // Owned by AppListModel.
64
65 int last_visible_index_;
66 int selected_index_;
67
68 // The factory that consolidates multiple Update calls into one.
69 base::WeakPtrFactory<SearchResultListView> update_factory_;
70
71 DISALLOW_COPY_AND_ASSIGN(SearchResultListView);
72 };
73
74 } // namespace app_ist
75
76 #endif // UI_APP_LIST_SEARCH_RESULT_LIST_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/search_box_view.cc ('k') | ui/app_list/search_result_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698