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