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 private: | 87 protected: |
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: |
92 // Updates UI with model. Returns the number of visible results. | 93 // Updates UI with model. Returns the number of visible results. |
93 virtual int DoUpdate() = 0; | 94 virtual int DoUpdate() = 0; |
94 | 95 |
95 // Updates UI for a change in the selected index. | 96 // Updates UI for a change in the selected index. |
96 virtual void UpdateSelectedIndex(int old_selected, int new_selected) = 0; | 97 virtual void UpdateSelectedIndex(int old_selected, int new_selected) = 0; |
97 | 98 |
98 Delegate* delegate_; | 99 Delegate* delegate_; |
99 | 100 |
100 int selected_index_; | 101 int selected_index_; |
101 int num_results_; | 102 int num_results_; |
102 | 103 |
103 double container_score_; | 104 double container_score_; |
104 | 105 |
105 AppListModel::SearchResults* results_; // Owned by AppListModel. | 106 AppListModel::SearchResults* results_; // Owned by AppListModel. |
106 | 107 |
107 // The factory that consolidates multiple Update calls into one. | 108 // The factory that consolidates multiple Update calls into one. |
108 base::WeakPtrFactory<SearchResultContainerView> update_factory_; | 109 base::WeakPtrFactory<SearchResultContainerView> update_factory_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(SearchResultContainerView); | 111 DISALLOW_COPY_AND_ASSIGN(SearchResultContainerView); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace app_list | 114 } // namespace app_list |
114 | 115 |
115 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ | 116 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_CONTAINER_VIEW_H_ |
OLD | NEW |