app_list_view_delegate.h revision 3551c9c881056c480085172ff9840cab31610854
1// Copyright (c) 2012 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 CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 6#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "base/callback_forward.h" 12#include "base/compiler_specific.h" 13#include "base/memory/scoped_ptr.h" 14#include "chrome/browser/profiles/profile_info_cache_observer.h" 15#include "content/public/browser/notification_observer.h" 16#include "content/public/browser/notification_registrar.h" 17#include "ui/app_list/app_list_view_delegate.h" 18 19class AppListControllerDelegate; 20class AppsModelBuilder; 21class Profile; 22 23namespace app_list { 24class SearchController; 25} 26 27namespace base { 28class FilePath; 29} 30 31namespace content { 32class NotificationDetails; 33class NotificationSource; 34} 35 36namespace gfx { 37class ImageSkia; 38} 39 40#if defined(USE_ASH) 41class AppSyncUIStateWatcher; 42#endif 43 44class AppListViewDelegate : public app_list::AppListViewDelegate, 45 public content::NotificationObserver, 46 public ProfileInfoCacheObserver { 47 public: 48 // The delegate will take ownership of the controller. 49 AppListViewDelegate(AppListControllerDelegate* controller, Profile* profile); 50 virtual ~AppListViewDelegate(); 51 52 private: 53 void OnProfileChanged(); 54 55 // Overridden from app_list::AppListViewDelegate: 56 virtual void SetModel(app_list::AppListModel* model) OVERRIDE; 57 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; 58 virtual void GetShortcutPathForApp( 59 const std::string& app_id, 60 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; 61 virtual void ActivateAppListItem(app_list::AppListItemModel* item, 62 int event_flags) OVERRIDE; 63 virtual void StartSearch() OVERRIDE; 64 virtual void StopSearch() OVERRIDE; 65 virtual void OpenSearchResult(app_list::SearchResult* result, 66 int event_flags) OVERRIDE; 67 virtual void InvokeSearchResultAction(app_list::SearchResult* result, 68 int action_index, 69 int event_flags) OVERRIDE; 70 virtual void Dismiss() OVERRIDE; 71 virtual void ViewClosing() OVERRIDE; 72 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; 73 virtual void OpenSettings() OVERRIDE; 74 virtual void OpenHelp() OVERRIDE; 75 virtual void OpenFeedback() OVERRIDE; 76 77 // Overridden from content::NotificationObserver: 78 virtual void Observe(int type, 79 const content::NotificationSource& source, 80 const content::NotificationDetails& details) OVERRIDE; 81 82 // Overridden from ProfileInfoCacheObserver: 83 virtual void OnProfileNameChanged( 84 const base::FilePath& profile_path, 85 const base::string16& old_profile_name) OVERRIDE; 86 87 scoped_ptr<app_list::SigninDelegate> signin_delegate_; 88 scoped_ptr<AppsModelBuilder> apps_builder_; 89 scoped_ptr<app_list::SearchController> search_controller_; 90 scoped_ptr<AppListControllerDelegate> controller_; 91 Profile* profile_; 92 app_list::AppListModel* model_; // Weak. Owned by AppListView. 93 94 content::NotificationRegistrar registrar_; 95#if defined(USE_ASH) 96 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; 97#endif 98 99 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); 100}; 101 102#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 103