Home | History | Annotate | Download | only in cocoa
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef UI_APP_LIST_COCOA_APP_LIST_VIEW_CONTROLLER_H_
      6 #define UI_APP_LIST_COCOA_APP_LIST_VIEW_CONTROLLER_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #include "base/mac/scoped_nsobject.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "ui/app_list/app_list_export.h"
     13 #import "ui/app_list/cocoa/apps_pagination_model_observer.h"
     14 #import "ui/app_list/cocoa/apps_search_box_controller.h"
     15 #import "ui/app_list/cocoa/apps_search_results_controller.h"
     16 
     17 namespace app_list {
     18 class AppListViewDelegate;
     19 class AppListModel;
     20 class AppListModelObserverBridge;
     21 }
     22 
     23 @class AppListPagerView;
     24 @class AppsGridController;
     25 
     26 // Controller for the top-level view of the app list UI. It creates and hosts an
     27 // AppsGridController (displaying an AppListModel), pager control to navigate
     28 // between pages in the grid, and search entry box with a pop up menu.
     29 APP_LIST_EXPORT
     30 @interface AppListViewController : NSViewController<AppsPaginationModelObserver,
     31                                                     AppsSearchBoxDelegate,
     32                                                     AppsSearchResultsDelegate> {
     33  @private
     34   base::scoped_nsobject<AppsGridController> appsGridController_;
     35   base::scoped_nsobject<AppListPagerView> pagerControl_;
     36   base::scoped_nsobject<AppsSearchBoxController> appsSearchBoxController_;
     37   base::scoped_nsobject<AppsSearchResultsController>
     38       appsSearchResultsController_;
     39 
     40   // Subview for drawing the background.
     41   base::scoped_nsobject<NSView> backgroundView_;
     42 
     43   // Subview of |backgroundView_| that slides out when search results are shown.
     44   base::scoped_nsobject<NSView> contentsView_;
     45 
     46   // Progress indicator that is visible while the delegate is NULL.
     47   base::scoped_nsobject<NSProgressIndicator> loadingIndicator_;
     48 
     49   scoped_ptr<app_list::AppListViewDelegate> delegate_;
     50   scoped_ptr<app_list::AppListModelObserverBridge>
     51       app_list_model_observer_bridge_;
     52   BOOL showingSearchResults_;
     53 }
     54 
     55 @property(readonly, nonatomic) AppsSearchBoxController*
     56     searchBoxController;
     57 
     58 - (app_list::AppListViewDelegate*)delegate;
     59 - (void)setDelegate:(scoped_ptr<app_list::AppListViewDelegate>)newDelegate;
     60 - (void)onProfilesChanged;
     61 
     62 @end
     63 
     64 @interface AppListViewController (TestingAPI)
     65 
     66 @property(nonatomic, readonly) BOOL showingSearchResults;
     67 
     68 - (AppsGridController*)appsGridController;
     69 - (NSSegmentedControl*)pagerControl;
     70 - (NSView*)backgroundView;
     71 
     72 @end
     73 
     74 #endif  // UI_APP_LIST_COCOA_APP_LIST_VIEW_CONTROLLER_H_
     75