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