Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.h

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rework Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
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 "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
16 #include "ui/app_list/app_list_view_delegate.h" 17 #include "ui/app_list/app_list_view_delegate.h"
17 #include "ui/app_list/signin_delegate_observer.h" 18 #include "ui/app_list/signin_delegate_observer.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
31 namespace gfx { 33 namespace gfx {
32 class ImageSkia; 34 class ImageSkia;
33 } 35 }
34 36
35 #if defined(USE_ASH) 37 #if defined(USE_ASH)
36 class AppSyncUIStateWatcher; 38 class AppSyncUIStateWatcher;
37 #endif 39 #endif
38 40
39 class AppListViewDelegate : public app_list::AppListViewDelegate, 41 class AppListViewDelegate : public app_list::AppListViewDelegate,
40 public app_list::SigninDelegateObserver, 42 public app_list::SigninDelegateObserver,
41 public content::NotificationObserver { 43 public content::NotificationObserver {
42 public: 44 public:
43 // The delegate will take ownership of the controller. 45 // The delegate will take ownership of the controller.
44 AppListViewDelegate(AppListControllerDelegate* controller, Profile* profile); 46 AppListViewDelegate(AppListControllerDelegate* controller, Profile* profile);
45 virtual ~AppListViewDelegate(); 47 virtual ~AppListViewDelegate();
46 48
49 // Overridden from app_list::AppListViewDelegate:
50 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE;
51
47 private: 52 private:
48 // Registers the current profile for notifications. 53 // Registers the current profile for notifications.
49 void RegisterForNotifications(); 54 void RegisterForNotifications();
55 // Updates the app list's current profile and ProfileMenuItems.
50 void OnProfileChanged(); 56 void OnProfileChanged();
51 57
52 // Overridden from app_list::AppListViewDelegate: 58 // Overridden from app_list::AppListViewDelegate:
53 virtual void SetModel(app_list::AppListModel* model) OVERRIDE; 59 virtual void InitModel(app_list::AppListModel* model) OVERRIDE;
54 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; 60 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE;
55 virtual void GetShortcutPathForApp( 61 virtual void GetShortcutPathForApp(
56 const std::string& app_id, 62 const std::string& app_id,
57 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; 63 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
58 virtual void ActivateAppListItem(app_list::AppListItemModel* item, 64 virtual void ActivateAppListItem(app_list::AppListItemModel* item,
59 int event_flags) OVERRIDE; 65 int event_flags) OVERRIDE;
60 virtual void StartSearch() OVERRIDE; 66 virtual void StartSearch() OVERRIDE;
61 virtual void StopSearch() OVERRIDE; 67 virtual void StopSearch() OVERRIDE;
62 virtual void OpenSearchResult(app_list::SearchResult* result, 68 virtual void OpenSearchResult(app_list::SearchResult* result,
63 int event_flags) OVERRIDE; 69 int event_flags) OVERRIDE;
64 virtual void InvokeSearchResultAction(app_list::SearchResult* result, 70 virtual void InvokeSearchResultAction(app_list::SearchResult* result,
65 int action_index, 71 int action_index,
66 int event_flags) OVERRIDE; 72 int event_flags) OVERRIDE;
67 virtual void Dismiss() OVERRIDE; 73 virtual void Dismiss() OVERRIDE;
68 virtual void ViewClosing() OVERRIDE; 74 virtual void ViewClosing() OVERRIDE;
69 virtual void ViewActivationChanged(bool active) OVERRIDE; 75 virtual void ViewActivationChanged(bool active) OVERRIDE;
70 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; 76 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
71 virtual void OpenSettings() OVERRIDE; 77 virtual void OpenSettings() OVERRIDE;
72 virtual void OpenHelp() OVERRIDE; 78 virtual void OpenHelp() OVERRIDE;
73 virtual void OpenFeedback() OVERRIDE; 79 virtual void OpenFeedback() OVERRIDE;
80 virtual void ShowForProfileByPath(
81 const base::FilePath& profile_path) OVERRIDE;
74 82
75 // Overridden from app_list::SigninDelegateObserver: 83 // Overridden from app_list::SigninDelegateObserver:
76 virtual void OnSigninSuccess() OVERRIDE; 84 virtual void OnSigninSuccess() OVERRIDE;
77 85
78 // Overridden from content::NotificationObserver: 86 // Overridden from content::NotificationObserver:
79 virtual void Observe(int type, 87 virtual void Observe(int type,
80 const content::NotificationSource& source, 88 const content::NotificationSource& source,
81 const content::NotificationDetails& details) OVERRIDE; 89 const content::NotificationDetails& details) OVERRIDE;
82 90
83 scoped_ptr<app_list::SigninDelegate> signin_delegate_; 91 scoped_ptr<ChromeSigninDelegate> signin_delegate_;
84 scoped_ptr<AppsModelBuilder> apps_builder_; 92 scoped_ptr<AppsModelBuilder> apps_builder_;
85 scoped_ptr<app_list::SearchController> search_controller_; 93 scoped_ptr<app_list::SearchController> search_controller_;
86 scoped_ptr<AppListControllerDelegate> controller_; 94 scoped_ptr<AppListControllerDelegate> controller_;
87 Profile* profile_; 95 Profile* profile_;
88 app_list::AppListModel* model_; // Weak. Owned by AppListView. 96 app_list::AppListModel* model_; // Weak. Owned by AppListView.
89 97
90 content::NotificationRegistrar registrar_; 98 content::NotificationRegistrar registrar_;
91 99
92 #if defined(USE_ASH) 100 #if defined(USE_ASH)
93 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; 101 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
94 #endif 102 #endif
95 103
96 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); 104 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
97 }; 105 };
98 106
99 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 107 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698