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 "chrome/browser/ui/app_list/chrome_signin_delegate.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
17 #include "ui/app_list/app_list_view_delegate.h" | 18 #include "ui/app_list/app_list_view_delegate.h" |
18 | 19 |
19 class AppListControllerDelegate; | 20 class AppListControllerDelegate; |
20 class AppsModelBuilder; | 21 class AppsModelBuilder; |
21 class Profile; | 22 class Profile; |
22 | 23 |
23 namespace app_list { | 24 namespace app_list { |
24 class SearchController; | 25 class SearchController; |
(...skipping 18 matching lines...) Expand all Loading... |
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 |
52 private: | 53 private: |
| 54 // Registers the current profile for notifications. |
| 55 void RegisterForNotifications(); |
| 56 // Updates the app list's current profile and ProfileMenuItems. |
53 void OnProfileChanged(); | 57 void OnProfileChanged(); |
54 | 58 |
55 // Overridden from app_list::AppListViewDelegate: | 59 // Overridden from app_list::AppListViewDelegate: |
56 virtual void SetModel(app_list::AppListModel* model) OVERRIDE; | 60 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; |
| 61 virtual void InitModel(app_list::AppListModel* model) OVERRIDE; |
57 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; | 62 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; |
58 virtual void GetShortcutPathForApp( | 63 virtual void GetShortcutPathForApp( |
59 const std::string& app_id, | 64 const std::string& app_id, |
60 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 65 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
61 virtual void ActivateAppListItem(app_list::AppListItemModel* item, | 66 virtual void ActivateAppListItem(app_list::AppListItemModel* item, |
62 int event_flags) OVERRIDE; | 67 int event_flags) OVERRIDE; |
63 virtual void StartSearch() OVERRIDE; | 68 virtual void StartSearch() OVERRIDE; |
64 virtual void StopSearch() OVERRIDE; | 69 virtual void StopSearch() OVERRIDE; |
65 virtual void OpenSearchResult(app_list::SearchResult* result, | 70 virtual void OpenSearchResult(app_list::SearchResult* result, |
66 int event_flags) OVERRIDE; | 71 int event_flags) OVERRIDE; |
67 virtual void InvokeSearchResultAction(app_list::SearchResult* result, | 72 virtual void InvokeSearchResultAction(app_list::SearchResult* result, |
68 int action_index, | 73 int action_index, |
69 int event_flags) OVERRIDE; | 74 int event_flags) OVERRIDE; |
70 virtual void Dismiss() OVERRIDE; | 75 virtual void Dismiss() OVERRIDE; |
71 virtual void ViewClosing() OVERRIDE; | 76 virtual void ViewClosing() OVERRIDE; |
72 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; | 77 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
73 virtual void OpenSettings() OVERRIDE; | 78 virtual void OpenSettings() OVERRIDE; |
74 virtual void OpenHelp() OVERRIDE; | 79 virtual void OpenHelp() OVERRIDE; |
75 virtual void OpenFeedback() OVERRIDE; | 80 virtual void OpenFeedback() OVERRIDE; |
| 81 virtual void ShowForProfileByPath( |
| 82 const base::FilePath& profile_path) OVERRIDE; |
76 | 83 |
77 // Overridden from content::NotificationObserver: | 84 // Overridden from content::NotificationObserver: |
78 virtual void Observe(int type, | 85 virtual void Observe(int type, |
79 const content::NotificationSource& source, | 86 const content::NotificationSource& source, |
80 const content::NotificationDetails& details) OVERRIDE; | 87 const content::NotificationDetails& details) OVERRIDE; |
81 | 88 |
82 // Overridden from ProfileInfoCacheObserver: | 89 // Overridden from ProfileInfoCacheObserver: |
| 90 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
83 virtual void OnProfileNameChanged( | 91 virtual void OnProfileNameChanged( |
84 const base::FilePath& profile_path, | 92 const base::FilePath& profile_path, |
85 const base::string16& old_profile_name) OVERRIDE; | 93 const base::string16& old_profile_name) OVERRIDE; |
86 | 94 |
87 scoped_ptr<app_list::SigninDelegate> signin_delegate_; | |
88 scoped_ptr<AppsModelBuilder> apps_builder_; | 95 scoped_ptr<AppsModelBuilder> apps_builder_; |
89 scoped_ptr<app_list::SearchController> search_controller_; | 96 scoped_ptr<app_list::SearchController> search_controller_; |
90 scoped_ptr<AppListControllerDelegate> controller_; | 97 scoped_ptr<AppListControllerDelegate> controller_; |
91 Profile* profile_; | 98 Profile* profile_; |
92 app_list::AppListModel* model_; // Weak. Owned by AppListView. | 99 app_list::AppListModel* model_; // Weak. Owned by AppListView. |
93 | 100 |
94 content::NotificationRegistrar registrar_; | 101 content::NotificationRegistrar registrar_; |
| 102 ChromeSigninDelegate signin_delegate_; |
95 #if defined(USE_ASH) | 103 #if defined(USE_ASH) |
96 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; | 104 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; |
97 #endif | 105 #endif |
98 | 106 |
99 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); | 107 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); |
100 }; | 108 }; |
101 | 109 |
102 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 110 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
OLD | NEW |