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

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

Issue 599933004: AppsGridView: Use specific types instead of views::View*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | ui/app_list/views/apps_grid_view.cc » ('j') | ui/app_list/views/apps_grid_view.cc » ('J')
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // Convert between the model index and the visual index. The model index 263 // Convert between the model index and the visual index. The model index
264 // is the index of the item in AppListModel. The visual index is the Index 264 // is the index of the item in AppListModel. The visual index is the Index
265 // struct above with page/slot info of where to display the item. 265 // struct above with page/slot info of where to display the item.
266 Index GetIndexFromModelIndex(int model_index) const; 266 Index GetIndexFromModelIndex(int model_index) const;
267 int GetModelIndexFromIndex(const Index& index) const; 267 int GetModelIndexFromIndex(const Index& index) const;
268 268
269 void SetSelectedItemByIndex(const Index& index); 269 void SetSelectedItemByIndex(const Index& index);
270 bool IsValidIndex(const Index& index) const; 270 bool IsValidIndex(const Index& index) const;
271 271
272 Index GetIndexOfView(const views::View* view) const; 272 Index GetIndexOfView(const views::View* view) const;
273 views::View* GetViewAtIndex(const Index& index) const; 273 AppListItemView* GetViewAtIndex(const Index& index) const;
calamity 2014/09/26 01:47:26 This should have a comment mentioning that these m
Matt Giuca 2014/09/26 03:48:39 If GetIndexOfView is only supposed to be passed an
274 274
275 // Gets the index of the AppListItemView at the end of the view model. 275 // Gets the index of the AppListItemView at the end of the view model.
276 Index GetLastViewIndex() const; 276 Index GetLastViewIndex() const;
277 277
278 void MoveSelected(int page_delta, int slot_x_delta, int slot_y_delta); 278 void MoveSelected(int page_delta, int slot_x_delta, int slot_y_delta);
279 279
280 void CalculateIdealBounds(); 280 void CalculateIdealBounds();
281 void AnimateToIdealBounds(); 281 void AnimateToIdealBounds();
282 282
283 // Invoked when the given |view|'s current bounds and target bounds are on 283 // Invoked when the given |view|'s current bounds and target bounds are on
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 // Invoked when |page_flip_timer_| fires. 326 // Invoked when |page_flip_timer_| fires.
327 void OnPageFlipTimer(); 327 void OnPageFlipTimer();
328 328
329 // Updates |model_| to move item represented by |item_view| to |target| slot. 329 // Updates |model_| to move item represented by |item_view| to |target| slot.
330 void MoveItemInModel(views::View* item_view, const Index& target); 330 void MoveItemInModel(views::View* item_view, const Index& target);
331 331
332 // Updates |model_| to move item represented by |item_view| into a folder 332 // Updates |model_| to move item represented by |item_view| into a folder
333 // containing item located at |target| slot, also update |view_model_| for 333 // containing item located at |target| slot, also update |view_model_| for
334 // the related view changes. 334 // the related view changes.
335 void MoveItemToFolder(views::View* item_view, const Index& target); 335 void MoveItemToFolder(AppListItemView* item_view, const Index& target);
336 336
337 // Updates both data model and view_model_ for re-parenting a folder item to a 337 // Updates both data model and view_model_ for re-parenting a folder item to a
338 // new position in top level item list. 338 // new position in top level item list.
339 void ReparentItemForReorder(views::View* item_view, const Index& target); 339 void ReparentItemForReorder(AppListItemView* item_view, const Index& target);
340 340
341 // Updates both data model and view_model_ for re-parenting a folder item 341 // Updates both data model and view_model_ for re-parenting a folder item
342 // to anther folder target. 342 // to anther folder target.
343 void ReparentItemToAnotherFolder(views::View* item_view, const Index& target); 343 void ReparentItemToAnotherFolder(AppListItemView* item_view,
344 const Index& target);
344 345
345 // If there is only 1 item left in the source folder after reparenting an item 346 // If there is only 1 item left in the source folder after reparenting an item
346 // from it, updates both data model and view_model_ for removing last item 347 // from it, updates both data model and view_model_ for removing last item
347 // from the source folder and removes the source folder. 348 // from the source folder and removes the source folder.
348 void RemoveLastItemFromReparentItemFolderIfNecessary( 349 void RemoveLastItemFromReparentItemFolderIfNecessary(
349 const std::string& source_folder_id); 350 const std::string& source_folder_id);
350 351
351 // If user does not drop the re-parenting folder item to any valid target, 352 // If user does not drop the re-parenting folder item to any valid target,
352 // cancel the re-parenting action, let the item go back to its original 353 // cancel the re-parenting action, let the item go back to its original
353 // parent folder with UI animation. 354 // parent folder with UI animation.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 Index GetNearestTileIndexForPoint(const gfx::Point& point) const; 408 Index GetNearestTileIndexForPoint(const gfx::Point& point) const;
408 409
409 // Gets the bounds of the tile located at |slot| on the current page. 410 // Gets the bounds of the tile located at |slot| on the current page.
410 gfx::Rect GetExpectedTileBounds(int slot) const; 411 gfx::Rect GetExpectedTileBounds(int slot) const;
411 412
412 // Gets the bounds of the tile located at |row| and |col| on the current page. 413 // Gets the bounds of the tile located at |row| and |col| on the current page.
413 gfx::Rect GetExpectedTileBounds(int row, int col) const; 414 gfx::Rect GetExpectedTileBounds(int row, int col) const;
414 415
415 // Gets the item view located at |slot| on the current page. If there is 416 // Gets the item view located at |slot| on the current page. If there is
416 // no item located at |slot|, returns NULL. 417 // no item located at |slot|, returns NULL.
417 views::View* GetViewAtSlotOnCurrentPage(int slot); 418 AppListItemView* GetViewAtSlotOnCurrentPage(int slot);
418 419
419 // Sets state of the view with |target_index| to |is_target_folder| for 420 // Sets state of the view with |target_index| to |is_target_folder| for
420 // dropping |drag_view_|. 421 // dropping |drag_view_|.
421 void SetAsFolderDroppingTarget(const Index& target_index, 422 void SetAsFolderDroppingTarget(const Index& target_index,
422 bool is_target_folder); 423 bool is_target_folder);
423 424
424 // Invoked when |reorder_timer_| fires to show re-order preview UI. 425 // Invoked when |reorder_timer_| fires to show re-order preview UI.
425 void OnReorderTimer(); 426 void OnReorderTimer();
426 427
427 // Invoked when |folder_item_reparent_timer_| fires. 428 // Invoked when |folder_item_reparent_timer_| fires.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 AppsGridViewFolderDelegate* folder_delegate_; 468 AppsGridViewFolderDelegate* folder_delegate_;
468 469
469 PaginationModel pagination_model_; 470 PaginationModel pagination_model_;
470 // Must appear after |pagination_model_|. 471 // Must appear after |pagination_model_|.
471 scoped_ptr<PaginationController> pagination_controller_; 472 scoped_ptr<PaginationController> pagination_controller_;
472 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. 473 PageSwitcher* page_switcher_view_; // Owned by views hierarchy.
473 474
474 int cols_; 475 int cols_;
475 int rows_per_page_; 476 int rows_per_page_;
476 477
477 // Tracks app item views. There is a view per item in |model_|. 478 // List of AppListItemViews. There is a view per item in |model_|.
478 views::ViewModel view_model_; 479 views::ViewModel view_model_;
479 480
480 // Tracks pulsing block views. 481 // Tracks pulsing block views.
481 views::ViewModel pulsing_blocks_model_; 482 views::ViewModel pulsing_blocks_model_;
482 483
483 views::View* selected_view_; 484 views::View* selected_view_;
484 485
485 AppListItemView* drag_view_; 486 AppListItemView* drag_view_;
486 487
487 // The index of the drag_view_ when the drag starts. 488 // The index of the drag_view_ when the drag starts.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 565
565 // True if the drag_view_ item is a folder item being dragged for reparenting. 566 // True if the drag_view_ item is a folder item being dragged for reparenting.
566 bool dragging_for_reparent_item_; 567 bool dragging_for_reparent_item_;
567 568
568 DISALLOW_COPY_AND_ASSIGN(AppsGridView); 569 DISALLOW_COPY_AND_ASSIGN(AppsGridView);
569 }; 570 };
570 571
571 } // namespace app_list 572 } // namespace app_list
572 573
573 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 574 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.cc » ('j') | ui/app_list/views/apps_grid_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698