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

Side by Side Diff: ui/app_list/views/apps_grid_view.h

Issue 598013003: Added views::ViewModelT<T>, a type-safe template version of ViewModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@appsgridview-static-casts
Patch Set: Fix browser_test compile on ChromeOS (missing include). Created 6 years, 2 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/views/app_list_main_view_unittest.cc ('k') | ui/app_list/views/apps_grid_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_APPS_GRID_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Handles EndDrag event in the hidden folder grid view to end reparenting 190 // Handles EndDrag event in the hidden folder grid view to end reparenting
191 // a folder item. 191 // a folder item.
192 void EndDragForReparentInHiddenFolderGridView(); 192 void EndDragForReparentInHiddenFolderGridView();
193 193
194 // Called when the folder item associated with the grid view is removed. 194 // Called when the folder item associated with the grid view is removed.
195 // The grid view must be inside a folder view. 195 // The grid view must be inside a folder view.
196 void OnFolderItemRemoved(); 196 void OnFolderItemRemoved();
197 197
198 // Return the view model for test purposes. 198 // Return the view model for test purposes.
199 const views::ViewModel* view_model_for_test() const { return &view_model_; } 199 const views::ViewModelT<AppListItemView>* view_model_for_test() const {
200 return &view_model_;
201 }
200 202
201 // For test: Return if the drag and drop handler was set. 203 // For test: Return if the drag and drop handler was set.
202 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } 204 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; }
203 205
204 // For test: Return if the drag and drop operation gets dispatched. 206 // For test: Return if the drag and drop operation gets dispatched.
205 bool forward_events_to_drag_and_drop_host_for_test() { 207 bool forward_events_to_drag_and_drop_host_for_test() {
206 return forward_events_to_drag_and_drop_host_; 208 return forward_events_to_drag_and_drop_host_;
207 } 209 }
208 210
209 void set_folder_delegate(AppsGridViewFolderDelegate* folder_delegate) { 211 void set_folder_delegate(AppsGridViewFolderDelegate* folder_delegate) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // Updates from model. 254 // Updates from model.
253 void Update(); 255 void Update();
254 256
255 // Updates page splits for item views. 257 // Updates page splits for item views.
256 void UpdatePaging(); 258 void UpdatePaging();
257 259
258 // Updates the number of pulsing block views based on AppListModel status and 260 // Updates the number of pulsing block views based on AppListModel status and
259 // number of apps. 261 // number of apps.
260 void UpdatePulsingBlockViews(); 262 void UpdatePulsingBlockViews();
261 263
262 // Returns the pulsing block view of the item at |index| in the pulsing block
263 // model.
264 PulsingBlockView* GetPulsingBlockViewAt(int index) const;
265
266 AppListItemView* CreateViewForItemAtIndex(size_t index); 264 AppListItemView* CreateViewForItemAtIndex(size_t index);
267 265
268 // Convert between the model index and the visual index. The model index 266 // Convert between the model index and the visual index. The model index
269 // is the index of the item in AppListModel. The visual index is the Index 267 // is the index of the item in AppListModel. The visual index is the Index
270 // struct above with page/slot info of where to display the item. 268 // struct above with page/slot info of where to display the item.
271 Index GetIndexFromModelIndex(int model_index) const; 269 Index GetIndexFromModelIndex(int model_index) const;
272 int GetModelIndexFromIndex(const Index& index) const; 270 int GetModelIndexFromIndex(const Index& index) const;
273 271
274 void SetSelectedItemByIndex(const Index& index); 272 void SetSelectedItemByIndex(const Index& index);
275 bool IsValidIndex(const Index& index) const; 273 bool IsValidIndex(const Index& index) const;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 AppsGridViewFolderDelegate* folder_delegate_; 473 AppsGridViewFolderDelegate* folder_delegate_;
476 474
477 PaginationModel pagination_model_; 475 PaginationModel pagination_model_;
478 // Must appear after |pagination_model_|. 476 // Must appear after |pagination_model_|.
479 scoped_ptr<PaginationController> pagination_controller_; 477 scoped_ptr<PaginationController> pagination_controller_;
480 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. 478 PageSwitcher* page_switcher_view_; // Owned by views hierarchy.
481 479
482 int cols_; 480 int cols_;
483 int rows_per_page_; 481 int rows_per_page_;
484 482
485 // List of AppListItemViews. There is a view per item in |model_|. 483 // List of app item views. There is a view per item in |model_|.
486 views::ViewModel view_model_; 484 views::ViewModelT<AppListItemView> view_model_;
487 485
488 // List of PulsingBlockViews. 486 // List of pulsing block views.
489 views::ViewModel pulsing_blocks_model_; 487 views::ViewModelT<PulsingBlockView> pulsing_blocks_model_;
490 488
491 AppListItemView* selected_view_; 489 AppListItemView* selected_view_;
492 490
493 AppListItemView* drag_view_; 491 AppListItemView* drag_view_;
494 492
495 // The index of the drag_view_ when the drag starts. 493 // The index of the drag_view_ when the drag starts.
496 Index drag_view_init_index_; 494 Index drag_view_init_index_;
497 495
498 // The point where the drag started in AppListItemView coordinates. 496 // The point where the drag started in AppListItemView coordinates.
499 gfx::Point drag_view_offset_; 497 gfx::Point drag_view_offset_;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 570
573 // True if the drag_view_ item is a folder item being dragged for reparenting. 571 // True if the drag_view_ item is a folder item being dragged for reparenting.
574 bool dragging_for_reparent_item_; 572 bool dragging_for_reparent_item_;
575 573
576 DISALLOW_COPY_AND_ASSIGN(AppsGridView); 574 DISALLOW_COPY_AND_ASSIGN(AppsGridView);
577 }; 575 };
578 576
579 } // namespace app_list 577 } // namespace app_list
580 578
581 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 579 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_main_view_unittest.cc ('k') | ui/app_list/views/apps_grid_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698