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 #ifndef UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_CONTROLLER_H_ | 5 #ifndef UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_CONTROLLER_H_ |
6 #define UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_CONTROLLER_H_ | 6 #define UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_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/mac/scoped_nsobject.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/app_list/app_list_export.h" | 12 #include "ui/app_list/app_list_export.h" |
13 #import "ui/base/cocoa/tracking_area.h" | 13 #import "ui/base/cocoa/tracking_area.h" |
14 | 14 |
15 namespace app_list { | 15 namespace app_list { |
16 class AppListModel; | 16 class AppListModel; |
17 class AppsSearchResultsModelBridge; | 17 class AppsSearchResultsModelBridge; |
18 class SearchResult; | 18 class SearchResult; |
19 } | 19 } |
20 | 20 |
21 @class AppsSearchResultsCell; | 21 @class AppsSearchResultsCell; |
22 | 22 |
23 @protocol AppsSearchResultsDelegate | 23 @protocol AppsSearchResultsDelegate |
24 | 24 |
25 - (app_list::AppListModel*)appListModel; | 25 - (app_list::AppListModel*)appListModel; |
26 - (void)openResult:(app_list::SearchResult*)result; | 26 - (void)openResult:(app_list::SearchResult*)result; |
27 | 27 |
28 @end | 28 @end |
29 | 29 |
30 // Controller for the search results displayed when a user types in the app list | 30 // Controller for the search results displayed when a user types in the app list |
31 // search box. Results display in an NSTableView with a single column. Each row | 31 // search box. Results display in an NSTableView with a single column. Each row |
32 // has an icon on the left, and one or two lines of formatted text describing | 32 // has an icon on the left, and one or two lines of formatted text describing |
33 // the result. | 33 // the result. |
34 APP_LIST_EXPORT | 34 APP_LIST_EXPORT |
35 @interface AppsSearchResultsController | 35 @interface AppsSearchResultsController |
36 : NSViewController<NSTableViewDelegate, NSTableViewDataSource> { | 36 : NSViewController<NSTableViewDelegate, NSTableViewDataSource> { |
37 @private | 37 @private |
38 scoped_nsobject<NSTableView> tableView_; | 38 base::scoped_nsobject<NSTableView> tableView_; |
39 ui::ScopedCrTrackingArea trackingArea_; | 39 ui::ScopedCrTrackingArea trackingArea_; |
40 NSPoint lastMouseDownInView_; | 40 NSPoint lastMouseDownInView_; |
41 NSInteger hoveredRowIndex_; | 41 NSInteger hoveredRowIndex_; |
42 scoped_ptr<app_list::AppsSearchResultsModelBridge> bridge_; | 42 scoped_ptr<app_list::AppsSearchResultsModelBridge> bridge_; |
43 id<AppsSearchResultsDelegate> delegate_; // Weak. Owns us. | 43 id<AppsSearchResultsDelegate> delegate_; // Weak. Owns us. |
44 } | 44 } |
45 | 45 |
46 @property(assign, nonatomic) id<AppsSearchResultsDelegate> delegate; | 46 @property(assign, nonatomic) id<AppsSearchResultsDelegate> delegate; |
47 | 47 |
48 - (id)initWithAppsSearchResultsFrameSize:(NSSize)size; | 48 - (id)initWithAppsSearchResultsFrameSize:(NSSize)size; |
49 | 49 |
50 // Returns true when handling Enter, to activate the highlighted search result, | 50 // Returns true when handling Enter, to activate the highlighted search result, |
51 // or up/down to navigate results. | 51 // or up/down to navigate results. |
52 - (BOOL)handleCommandBySelector:(SEL)command; | 52 - (BOOL)handleCommandBySelector:(SEL)command; |
53 | 53 |
54 @end | 54 @end |
55 | 55 |
56 @interface AppsSearchResultsController (TestingAPI) | 56 @interface AppsSearchResultsController (TestingAPI) |
57 | 57 |
58 - (NSTableView*)tableView; | 58 - (NSTableView*)tableView; |
59 | 59 |
60 @end | 60 @end |
61 | 61 |
62 #endif // UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_CONTROLLER_H_ | 62 #endif // UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_CONTROLLER_H_ |
OLD | NEW |