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

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

Issue 19460003: One-click install for the OSX App Launcher Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaner, more future-proof Created 6 years, 11 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_SEARCH_RESULTS_MODEL_BRIDGE_H_ 5 #ifndef UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_
6 #define UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_ 6 #define UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_
7 7
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "ui/base/models/list_model_observer.h" 10 #include "ui/base/models/list_model_observer.h"
11 11
12 @class NSMenu; 12 @class NSMenu;
13 @class AppsSearchResultsController; 13 @class AppsSearchResultsController;
14 14
15 namespace app_list { 15 namespace app_list {
16 16
17 // Bridge observing the ListModel representing search results in the app list, 17 // Bridge observing the ListModel representing search results in the app list,
18 // and updating the NSTableView where they are displayed. 18 // and updating the NSTableView where they are displayed.
19 class AppsSearchResultsModelBridge : public ui::ListModelObserver { 19 class AppsSearchResultsModelBridge : public ui::ListModelObserver {
20 public: 20 public:
21 // Lightweight observer to react to icon updates on individual results.
22 class ItemObserver;
23
21 explicit AppsSearchResultsModelBridge( 24 explicit AppsSearchResultsModelBridge(
22 AppsSearchResultsController* results_controller); 25 AppsSearchResultsController* results_controller);
23 virtual ~AppsSearchResultsModelBridge(); 26 virtual ~AppsSearchResultsModelBridge();
24 27
25 // Returns the context menu for the item at |index| in the search results 28 // Returns the context menu for the item at |index| in the search results
26 // model. A menu will be generated if it hasn't been previously requested. 29 // model. A menu will be generated if it hasn't been previously requested.
27 NSMenu* MenuForItem(size_t index); 30 NSMenu* MenuForItem(size_t index);
28 31
32 // Returns the width taken up by any action buttons on the item at |index|.
33 CGFloat ActionButtonWidthForItem(size_t index);
34
29 private: 35 private:
30 // Lightweight observer to react to icon updates on individual results.
31 class ItemObserver;
32
33 void UpdateItemObservers(); 36 void UpdateItemObservers();
34 void ReloadDataForItems(size_t start, size_t count) const; 37 void ReloadDataForItems(size_t start, size_t count) const;
35 38
36 // Overridden from ui::ListModelObserver: 39 // Overridden from ui::ListModelObserver:
37 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; 40 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
38 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; 41 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
39 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; 42 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE;
40 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; 43 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE;
41 44
42 AppsSearchResultsController* parent_; // Weak. Owns us. 45 AppsSearchResultsController* parent_; // Weak. Owns us.
43 ScopedVector<ItemObserver> item_observers_; 46 ScopedVector<ItemObserver> item_observers_;
44 47
45 DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsModelBridge); 48 DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsModelBridge);
46 }; 49 };
47 50
48 } // namespace app_list 51 } // namespace app_list
49 52
50 #endif // UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_ 53 #endif // UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_
OLDNEW
« no previous file with comments | « ui/app_list/cocoa/apps_search_results_controller_unittest.mm ('k') | ui/app_list/cocoa/apps_search_results_model_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698