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