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_collection_view_drag_manager.h" | 5 #import "ui/app_list/cocoa/apps_collection_view_drag_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #import "ui/app_list/cocoa/apps_grid_controller.h" | 9 #import "ui/app_list/cocoa/apps_grid_controller.h" |
10 #import "ui/app_list/cocoa/apps_grid_view_item.h" | 10 #import "ui/app_list/cocoa/apps_grid_view_item.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if ((self = [super init])) { | 52 if ((self = [super init])) { |
53 cellSize_ = cellSize; | 53 cellSize_ = cellSize; |
54 rows_ = rows; | 54 rows_ = rows; |
55 columns_ = columns; | 55 columns_ = columns; |
56 gridController_ = gridController; | 56 gridController_ = gridController; |
57 } | 57 } |
58 return self; | 58 return self; |
59 } | 59 } |
60 | 60 |
61 - (NSCollectionView*)makePageWithFrame:(NSRect)pageFrame { | 61 - (NSCollectionView*)makePageWithFrame:(NSRect)pageFrame { |
62 scoped_nsobject<GridCollectionView> itemCollectionView( | 62 base::scoped_nsobject<GridCollectionView> itemCollectionView( |
63 [[GridCollectionView alloc] initWithFrame:pageFrame]); | 63 [[GridCollectionView alloc] initWithFrame:pageFrame]); |
64 [itemCollectionView setFactory:self]; | 64 [itemCollectionView setFactory:self]; |
65 [itemCollectionView setMaxNumberOfRows:rows_]; | 65 [itemCollectionView setMaxNumberOfRows:rows_]; |
66 [itemCollectionView setMinItemSize:cellSize_]; | 66 [itemCollectionView setMinItemSize:cellSize_]; |
67 [itemCollectionView setMaxItemSize:cellSize_]; | 67 [itemCollectionView setMaxItemSize:cellSize_]; |
68 [itemCollectionView setSelectable:YES]; | 68 [itemCollectionView setSelectable:YES]; |
69 [itemCollectionView setFocusRingType:NSFocusRingTypeNone]; | 69 [itemCollectionView setFocusRingType:NSFocusRingTypeNone]; |
70 [itemCollectionView setBackgroundColors: | 70 [itemCollectionView setBackgroundColors: |
71 [NSArray arrayWithObject:[NSColor clearColor]]]; | 71 [NSArray arrayWithObject:[NSColor clearColor]]]; |
72 | 72 |
73 scoped_nsobject<AppsGridViewItem> itemPrototype( | 73 base::scoped_nsobject<AppsGridViewItem> itemPrototype( |
74 [[AppsGridViewItem alloc] initWithSize:cellSize_]); | 74 [[AppsGridViewItem alloc] initWithSize:cellSize_]); |
75 [[itemPrototype button] setTarget:gridController_]; | 75 [[itemPrototype button] setTarget:gridController_]; |
76 [[itemPrototype button] setAction:@selector(onItemClicked:)]; | 76 [[itemPrototype button] setAction:@selector(onItemClicked:)]; |
77 | 77 |
78 [itemCollectionView setItemPrototype:itemPrototype]; | 78 [itemCollectionView setItemPrototype:itemPrototype]; |
79 return itemCollectionView.autorelease(); | 79 return itemCollectionView.autorelease(); |
80 } | 80 } |
81 | 81 |
82 - (void)onMouseDownInPage:(NSCollectionView*)page | 82 - (void)onMouseDownInPage:(NSCollectionView*)page |
83 withEvent:(NSEvent*)theEvent { | 83 withEvent:(NSEvent*)theEvent { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 - (void)mouseUp:(NSEvent*)theEvent { | 254 - (void)mouseUp:(NSEvent*)theEvent { |
255 [factory_ onMouseUp:theEvent]; | 255 [factory_ onMouseUp:theEvent]; |
256 } | 256 } |
257 | 257 |
258 - (BOOL)acceptsFirstResponder { | 258 - (BOOL)acceptsFirstResponder { |
259 return NO; | 259 return NO; |
260 } | 260 } |
261 | 261 |
262 @end | 262 @end |
OLD | NEW |