OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void ListItemsChanged(size_t start, size_t count) override; | 77 void ListItemsChanged(size_t start, size_t count) override; |
78 | 78 |
79 // Updates the container for being selected. |from_bottom| is true if the view | 79 // Updates the container for being selected. |from_bottom| is true if the view |
80 // was entered into from a selected view below it; false if entered into from | 80 // was entered into from a selected view below it; false if entered into from |
81 // above. |directional_movement| is true if the navigation was caused by | 81 // above. |directional_movement| is true if the navigation was caused by |
82 // directional controls (eg, arrow keys), as opposed to linear controls (eg, | 82 // directional controls (eg, arrow keys), as opposed to linear controls (eg, |
83 // Tab). | 83 // Tab). |
84 virtual void OnContainerSelected(bool from_bottom, | 84 virtual void OnContainerSelected(bool from_bottom, |
85 bool directional_movement) = 0; | 85 bool directional_movement) = 0; |
86 | 86 |
87 protected: | 87 private: |
88 // Schedules an Update call using |update_factory_|. Do nothing if there is a | 88 // Schedules an Update call using |update_factory_|. Do nothing if there is a |
89 // pending call. | 89 // pending call. |
90 void ScheduleUpdate(); | 90 void ScheduleUpdate(); |
91 | 91 |
92 private: | |
93 // Updates UI with model. Returns the number of visible results. | 92 // Updates UI with model. Returns the number of visible results. |
94 virtual int DoUpdate() = 0; | 93 virtual int DoUpdate() = 0; |
95 | 94 |
96 // Updates UI for a change in the selected index. | 95 // Updates UI for a change in the selected index. |
97 virtual void UpdateSelectedIndex(int old_selected, int new_selected) = 0; | 96 virtual void UpdateSelectedIndex(int old_selected, int new_selected) = 0; |
98 | 97 |
99 Delegate* delegate_; | 98 Delegate* delegate_; |
100 | 99 |
101 int selected_index_; | 100 int selected_index_; |
102 int num_results_; | 101 int num_results_; |
103 | 102 |
104 double container_score_; | 103 double container_score_; |
105 | 104 |
106 AppListModel::SearchResults* results_; // Owned by AppListModel. | 105 AppListModel::SearchResults* results_; // Owned by AppListModel. |
107 | 106 |
108 // The factory that consolidates multiple Update calls into one. | 107 // The factory that consolidates multiple Update calls into one. |
109 base::WeakPtrFactory<SearchResultContainerView> update_factory_; | 108 base::WeakPtrFactory<SearchResultContainerView> update_factory_; |
110 | 109 |
111 DISALLOW_COPY_AND_ASSIGN(SearchResultContainerView); | 110 DISALLOW_COPY_AND_ASSIGN(SearchResultContainerView); |
112 }; | 111 }; |
113 | 112 |
114 } // namespace app_list | 113 } // namespace app_list |
115 | 114 |
116 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ | 115 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ |
OLD | NEW |