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

Side by Side Diff: ui/app_list/cocoa/apps_grid_controller.h

Issue 12701022: wrongbaseurl OSX App List Pager and root view controller. (Closed) Base URL: http://git.chromium.org/chromium/src.git@20130304-crbug-138633-osx-app-list-demo-polish-macbook
Patch Set: delegate should be owned by viewcontroller, test coverage Created 7 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_COCOA_APPS_GRID_CONTROLLER_H_ 5 #ifndef UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
6 #define UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_ 6 #define UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h" 12 #import "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h"
13 13
14 namespace app_list { 14 namespace app_list {
15 class AppListModel; 15 class AppListModel;
16 class AppListViewDelegate; 16 class AppListViewDelegate;
17 class AppsGridDelegateBridge; 17 class AppsGridDelegateBridge;
18 } 18 }
19 19
20 @class AppsGridViewItem; 20 @class AppsGridViewItem;
21 @protocol AppsPaginationModelObserver;
21 22
22 // Controls a grid of views, representing AppListModel::Apps sub models. 23 // Controls a grid of views, representing AppListModel::Apps sub models.
23 @interface AppsGridController : NSViewController<GestureScrollDelegate> { 24 @interface AppsGridController : NSViewController<GestureScrollDelegate> {
24 @private 25 @private
25 scoped_ptr<app_list::AppListModel> model_; 26 scoped_ptr<app_list::AppListModel> model_;
26 scoped_ptr<app_list::AppListViewDelegate> delegate_; 27 app_list::AppListViewDelegate* delegate_; // Weak. Owned by view controller.
27 scoped_ptr<app_list::AppsGridDelegateBridge> bridge_; 28 scoped_ptr<app_list::AppsGridDelegateBridge> bridge_;
28 29
29 scoped_nsobject<NSMutableArray> pages_; 30 scoped_nsobject<NSMutableArray> pages_;
30 scoped_nsobject<NSMutableArray> items_; 31 scoped_nsobject<NSMutableArray> items_;
31 32
33 id<AppsPaginationModelObserver> paginationObserver_;
34
35 // Index of the currently visible page.
36 size_t visiblePage_;
37
32 // Whether we are currently animating a scroll to the nearest page. 38 // Whether we are currently animating a scroll to the nearest page.
33 BOOL animatingScroll_; 39 BOOL animatingScroll_;
34 } 40 }
35 41
36 - (id)initWithViewDelegate: 42 @property(assign, nonatomic) id<AppsPaginationModelObserver> paginationObserver;
37 (scoped_ptr<app_list::AppListViewDelegate>)appListViewDelegate; 43
44 + (void)setScrollAnimationDuration:(NSTimeInterval)duration;
38 45
39 - (NSCollectionView*)collectionViewAtPageIndex:(size_t)pageIndex; 46 - (NSCollectionView*)collectionViewAtPageIndex:(size_t)pageIndex;
40 47
41 - (AppsGridViewItem*)itemAtIndex:(size_t)itemIndex; 48 - (AppsGridViewItem*)itemAtIndex:(size_t)itemIndex;
42 49
43 - (app_list::AppListModel*)model; 50 - (app_list::AppListModel*)model;
44 51
45 - (app_list::AppListViewDelegate*)delegate; 52 - (void)setModel:(scoped_ptr<app_list::AppListModel>)newModel;
46 53
47 - (void)setModel:(scoped_ptr<app_list::AppListModel>)model; 54 - (void)setDelegate:(app_list::AppListViewDelegate*)newDelegate;
55
56 - (size_t)visiblePage;
48 57
49 // Calls delegate_->ActivateAppListItem for the currently selected item by 58 // Calls delegate_->ActivateAppListItem for the currently selected item by
50 // simulating a click. 59 // simulating a click.
51 - (void)activateSelection; 60 - (void)activateSelection;
52 61
53 // Return the number of pages of icons in the grid. 62 // Return the number of pages of icons in the grid.
54 - (size_t)pageCount; 63 - (size_t)pageCount;
55 64
56 // Scroll to a page in the grid view with an animation. 65 // Scroll to a page in the grid view with an animation.
57 - (void)scrollToPage:(size_t)pageIndex; 66 - (void)scrollToPage:(size_t)pageIndex;
58 67
59 @end 68 @end
60 69
61 #endif // UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_ 70 #endif // UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/app_list/cocoa/app_list_window_controller_unittest.mm ('k') | ui/app_list/cocoa/apps_grid_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698