OLD | NEW |
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 #import "ui/app_list/cocoa/apps_grid_controller.h" | 5 #import "ui/app_list/cocoa/apps_grid_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "ui/app_list/app_list_item_model.h" |
8 #include "ui/app_list/app_list_model.h" | 9 #include "ui/app_list/app_list_model.h" |
9 #include "ui/app_list/app_list_model_observer.h" | 10 #include "ui/app_list/app_list_model_observer.h" |
10 #include "ui/app_list/app_list_view_delegate.h" | 11 #include "ui/app_list/app_list_view_delegate.h" |
11 #import "ui/app_list/cocoa/apps_collection_view_drag_manager.h" | 12 #import "ui/app_list/cocoa/apps_collection_view_drag_manager.h" |
12 #import "ui/app_list/cocoa/apps_grid_view_item.h" | 13 #import "ui/app_list/cocoa/apps_grid_view_item.h" |
13 #import "ui/app_list/cocoa/apps_pagination_model_observer.h" | 14 #import "ui/app_list/cocoa/apps_pagination_model_observer.h" |
14 #include "ui/base/models/list_model_observer.h" | 15 #include "ui/base/models/list_model_observer.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 376 |
376 visiblePage_ = newPage; | 377 visiblePage_ = newPage; |
377 [paginationObserver_ selectedPageChanged:newPage]; | 378 [paginationObserver_ selectedPageChanged:newPage]; |
378 [paginationObserver_ pageVisibilityChanged]; | 379 [paginationObserver_ pageVisibilityChanged]; |
379 } | 380 } |
380 | 381 |
381 - (void)onItemClicked:(id)sender { | 382 - (void)onItemClicked:(id)sender { |
382 for (size_t i = 0; i < [items_ count]; ++i) { | 383 for (size_t i = 0; i < [items_ count]; ++i) { |
383 AppsGridViewItem* item = [self itemAtIndex:i]; | 384 AppsGridViewItem* item = [self itemAtIndex:i]; |
384 if ([[item button] isEqual:sender]) | 385 if ([[item button] isEqual:sender]) |
385 delegate_->ActivateAppListItem([item model], 0); | 386 [item model]->Activate(0); |
386 } | 387 } |
387 } | 388 } |
388 | 389 |
389 - (AppsGridViewItem*)itemAtPageIndex:(size_t)pageIndex | 390 - (AppsGridViewItem*)itemAtPageIndex:(size_t)pageIndex |
390 indexInPage:(size_t)indexInPage { | 391 indexInPage:(size_t)indexInPage { |
391 return base::mac::ObjCCastStrict<AppsGridViewItem>( | 392 return base::mac::ObjCCastStrict<AppsGridViewItem>( |
392 [[self collectionViewAtPageIndex:pageIndex] itemAtIndex:indexInPage]); | 393 [[self collectionViewAtPageIndex:pageIndex] itemAtIndex:indexInPage]); |
393 } | 394 } |
394 | 395 |
395 - (AppsGridViewItem*)itemAtIndex:(size_t)itemIndex { | 396 - (AppsGridViewItem*)itemAtIndex:(size_t)itemIndex { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 return [self moveSelectionByDelta:-kItemsPerPage]; | 671 return [self moveSelectionByDelta:-kItemsPerPage]; |
671 | 672 |
672 if (command == @selector(pageDown:) || | 673 if (command == @selector(pageDown:) || |
673 command == @selector(scrollPageDown:)) | 674 command == @selector(scrollPageDown:)) |
674 return [self moveSelectionByDelta:kItemsPerPage]; | 675 return [self moveSelectionByDelta:kItemsPerPage]; |
675 | 676 |
676 return NO; | 677 return NO; |
677 } | 678 } |
678 | 679 |
679 @end | 680 @end |
OLD | NEW |