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

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

Issue 302803002: Refactor app list so AppsGridView owns the PaginationModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error (conflict). Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/apps_container_view.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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
13 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
14 #include "ui/app_list/app_list_export.h" 15 #include "ui/app_list/app_list_export.h"
15 #include "ui/app_list/app_list_model.h" 16 #include "ui/app_list/app_list_model.h"
16 #include "ui/app_list/app_list_model_observer.h" 17 #include "ui/app_list/app_list_model_observer.h"
18 #include "ui/app_list/pagination_model.h"
17 #include "ui/app_list/pagination_model_observer.h" 19 #include "ui/app_list/pagination_model_observer.h"
18 #include "ui/base/models/list_model_observer.h" 20 #include "ui/base/models/list_model_observer.h"
19 #include "ui/compositor/layer_animation_observer.h" 21 #include "ui/compositor/layer_animation_observer.h"
20 #include "ui/gfx/image/image_skia_operations.h" 22 #include "ui/gfx/image/image_skia_operations.h"
21 #include "ui/views/animation/bounds_animator.h" 23 #include "ui/views/animation/bounds_animator.h"
22 #include "ui/views/controls/button/button.h" 24 #include "ui/views/controls/button/button.h"
23 #include "ui/views/controls/image_view.h" 25 #include "ui/views/controls/image_view.h"
24 #include "ui/views/view.h" 26 #include "ui/views/view.h"
25 #include "ui/views/view_model.h" 27 #include "ui/views/view_model.h"
26 28
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 public AppListModelObserver, 65 public AppListModelObserver,
64 public ui::ImplicitAnimationObserver { 66 public ui::ImplicitAnimationObserver {
65 public: 67 public:
66 enum Pointer { 68 enum Pointer {
67 NONE, 69 NONE,
68 MOUSE, 70 MOUSE,
69 TOUCH, 71 TOUCH,
70 }; 72 };
71 73
72 // Constructs the app icon grid view. |delegate| is the delegate of this 74 // Constructs the app icon grid view. |delegate| is the delegate of this
73 // view, which usually is the hosting AppListView. |pagination_model| is 75 // view, which usually is the hosting AppListView.
74 // the paging info shared within the launcher UI. 76 explicit AppsGridView(AppsGridViewDelegate* delegate);
75 AppsGridView(AppsGridViewDelegate* delegate,
76 PaginationModel* pagination_model);
77 virtual ~AppsGridView(); 77 virtual ~AppsGridView();
78 78
79 // Sets fixed layout parameters. After setting this, CalculateLayout below 79 // Sets fixed layout parameters. After setting this, CalculateLayout below
80 // is no longer called to dynamically choosing those layout params. 80 // is no longer called to dynamically choosing those layout params.
81 void SetLayout(int icon_size, int cols, int rows_per_page); 81 void SetLayout(int icon_size, int cols, int rows_per_page);
82 82
83 int cols() const { return cols_; } 83 int cols() const { return cols_; }
84 int rows_per_page() const { return rows_per_page_; } 84 int rows_per_page() const { return rows_per_page_; }
85 85
86 // This resets the grid view to a fresh state for showing the app list. 86 // This resets the grid view to a fresh state for showing the app list.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // Prerenders the icons on and around |page_index|. 125 // Prerenders the icons on and around |page_index|.
126 void Prerender(int page_index); 126 void Prerender(int page_index);
127 127
128 // Return true if the |bounds_animator_| is animating |view|. 128 // Return true if the |bounds_animator_| is animating |view|.
129 bool IsAnimatingView(views::View* view); 129 bool IsAnimatingView(views::View* view);
130 130
131 bool has_dragged_view() const { return drag_view_ != NULL; } 131 bool has_dragged_view() const { return drag_view_ != NULL; }
132 bool dragging() const { return drag_pointer_ != NONE; } 132 bool dragging() const { return drag_pointer_ != NONE; }
133 133
134 // Gets the PaginationModel used for the grid view.
135 PaginationModel* pagination_model() { return &pagination_model_; }
136
134 // Overridden from views::View: 137 // Overridden from views::View:
135 virtual gfx::Size GetPreferredSize() const OVERRIDE; 138 virtual gfx::Size GetPreferredSize() const OVERRIDE;
136 virtual void Layout() OVERRIDE; 139 virtual void Layout() OVERRIDE;
137 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 140 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
138 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; 141 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE;
139 virtual void ViewHierarchyChanged( 142 virtual void ViewHierarchyChanged(
140 const ViewHierarchyChangedDetails& details) OVERRIDE; 143 const ViewHierarchyChangedDetails& details) OVERRIDE;
141 virtual bool GetDropFormats( 144 virtual bool GetDropFormats(
142 int* formats, 145 int* formats,
143 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; 146 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const base::FilePath& path); 457 const base::FilePath& path);
455 #endif 458 #endif
456 459
457 AppListModel* model_; // Owned by AppListView. 460 AppListModel* model_; // Owned by AppListView.
458 AppListItemList* item_list_; // Not owned. 461 AppListItemList* item_list_; // Not owned.
459 AppsGridViewDelegate* delegate_; 462 AppsGridViewDelegate* delegate_;
460 463
461 // This can be NULL. Only grid views inside folders have a folder delegate. 464 // This can be NULL. Only grid views inside folders have a folder delegate.
462 AppsGridViewFolderDelegate* folder_delegate_; 465 AppsGridViewFolderDelegate* folder_delegate_;
463 466
464 PaginationModel* pagination_model_; // Owned by AppListController. 467 PaginationModel pagination_model_;
465 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. 468 PageSwitcher* page_switcher_view_; // Owned by views hierarchy.
466 469
467 gfx::Size icon_size_; 470 gfx::Size icon_size_;
468 int cols_; 471 int cols_;
469 int rows_per_page_; 472 int rows_per_page_;
470 473
471 // Tracks app item views. There is a view per item in |model_|. 474 // Tracks app item views. There is a view per item in |model_|.
472 views::ViewModel view_model_; 475 views::ViewModel view_model_;
473 476
474 // Tracks pulsing block views. 477 // Tracks pulsing block views.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 550
548 // True if the drag_view_ item is a folder item being dragged for reparenting. 551 // True if the drag_view_ item is a folder item being dragged for reparenting.
549 bool dragging_for_reparent_item_; 552 bool dragging_for_reparent_item_;
550 553
551 DISALLOW_COPY_AND_ASSIGN(AppsGridView); 554 DISALLOW_COPY_AND_ASSIGN(AppsGridView);
552 }; 555 };
553 556
554 } // namespace app_list 557 } // namespace app_list
555 558
556 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 559 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_container_view.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