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 UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
6 #define UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 6 #define UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #if defined(TOOLKIT_VIEWS) | 26 #if defined(TOOLKIT_VIEWS) |
27 namespace views { | 27 namespace views { |
28 class View; | 28 class View; |
29 } | 29 } |
30 #endif | 30 #endif |
31 | 31 |
32 namespace app_list { | 32 namespace app_list { |
33 | 33 |
34 class AppListModel; | 34 class AppListModel; |
35 class AppListViewDelegateObserver; | |
36 class SearchResult; | 35 class SearchResult; |
37 class SpeechUIModel; | 36 class SpeechUIModel; |
38 | 37 |
39 class APP_LIST_EXPORT AppListViewDelegate { | 38 class APP_LIST_EXPORT AppListViewDelegate { |
40 public: | 39 public: |
41 // A user of the app list. | |
42 struct APP_LIST_EXPORT User { | |
43 User(); | |
44 User(const User& other); | |
45 ~User(); | |
46 | |
47 // Whether or not this user is the current user of the app list. | |
48 bool active; | |
49 | |
50 // The name of this user. | |
51 base::string16 name; | |
52 | |
53 // The email address of this user. | |
54 base::string16 email; | |
55 | |
56 // The path to this user's profile directory. | |
57 base::FilePath profile_path; | |
58 }; | |
59 typedef std::vector<User> Users; | |
60 | |
61 virtual ~AppListViewDelegate() {} | 40 virtual ~AppListViewDelegate() {} |
62 | 41 |
63 // Whether to force the use of a native desktop widget when the app list | 42 // Whether to force the use of a native desktop widget when the app list |
64 // window is first created. | 43 // window is first created. |
65 virtual bool ForceNativeDesktop() const = 0; | 44 virtual bool ForceNativeDesktop() const = 0; |
66 | 45 |
67 // Sets the delegate to use the profile at |profile_path|. This is currently | 46 // Sets the delegate to use the profile at |profile_path|. |
68 // only used by non-Ash Windows. | |
69 virtual void SetProfileByPath(const base::FilePath& profile_path) = 0; | 47 virtual void SetProfileByPath(const base::FilePath& profile_path) = 0; |
70 | 48 |
71 // Gets the model associated with the view delegate. The model may be owned | 49 // Gets the model associated with the view delegate. The model may be owned |
72 // by the delegate, or owned elsewhere (e.g. a profile keyed service). | 50 // by the delegate, or owned elsewhere (e.g. a profile keyed service). |
73 virtual AppListModel* GetModel() = 0; | 51 virtual AppListModel* GetModel() = 0; |
74 | 52 |
75 // Gets the SpeechUIModel for the app list. Owned by the AppListViewDelegate. | 53 // Gets the SpeechUIModel for the app list. Owned by the AppListViewDelegate. |
76 virtual SpeechUIModel* GetSpeechUI() = 0; | 54 virtual SpeechUIModel* GetSpeechUI() = 0; |
77 | 55 |
78 // Gets a path to a shortcut for the given app. Returns asynchronously as the | 56 // Gets a path to a shortcut for the given app. Returns asynchronously as the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Invoked when the app list UI is created. | 88 // Invoked when the app list UI is created. |
111 virtual void ViewInitialized() = 0; | 89 virtual void ViewInitialized() = 0; |
112 | 90 |
113 // Invoked to dismiss app list. This may leave the view open but hidden from | 91 // Invoked to dismiss app list. This may leave the view open but hidden from |
114 // the user. | 92 // the user. |
115 virtual void Dismiss() = 0; | 93 virtual void Dismiss() = 0; |
116 | 94 |
117 // Invoked when the app list is closing. | 95 // Invoked when the app list is closing. |
118 virtual void ViewClosing() = 0; | 96 virtual void ViewClosing() = 0; |
119 | 97 |
120 // Open the help UI. | |
121 virtual void OpenHelp() = 0; | |
122 | |
123 // Open the feedback UI. | |
124 virtual void OpenFeedback() = 0; | |
125 | |
126 // Invoked to toggle the status of speech recognition. | 98 // Invoked to toggle the status of speech recognition. |
127 virtual void StartSpeechRecognition() = 0; | 99 virtual void StartSpeechRecognition() = 0; |
128 virtual void StopSpeechRecognition() = 0; | 100 virtual void StopSpeechRecognition() = 0; |
129 | 101 |
130 // Shows the app list for the profile specified by |profile_path|. | |
131 virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0; | |
132 | |
133 #if defined(TOOLKIT_VIEWS) | 102 #if defined(TOOLKIT_VIEWS) |
134 // Creates the web view for the start page. The caller takes the ownership of | 103 // Creates the web view for the start page. The caller takes the ownership of |
135 // the returned view. | 104 // the returned view. |
136 virtual views::View* CreateStartPageWebView(const gfx::Size& size) = 0; | 105 virtual views::View* CreateStartPageWebView(const gfx::Size& size) = 0; |
137 | 106 |
138 // Creates the web views for the user-specified custom pages. The caller takes | 107 // Creates the web views for the user-specified custom pages. The caller takes |
139 // ownership of the returned views. | 108 // ownership of the returned views. |
140 virtual std::vector<views::View*> CreateCustomPageWebViews( | 109 virtual std::vector<views::View*> CreateCustomPageWebViews( |
141 const gfx::Size& size) = 0; | 110 const gfx::Size& size) = 0; |
142 | 111 |
143 // Invoked when the custom launcher page's animation changes. | 112 // Invoked when the custom launcher page's animation changes. |
144 virtual void CustomLauncherPageAnimationChanged(double progress) = 0; | 113 virtual void CustomLauncherPageAnimationChanged(double progress) = 0; |
145 | 114 |
146 // Invoked when the custom launcher page's subpage should be popped. | 115 // Invoked when the custom launcher page's subpage should be popped. |
147 virtual void CustomLauncherPagePopSubpage() = 0; | 116 virtual void CustomLauncherPagePopSubpage() = 0; |
148 #endif | 117 #endif |
149 | 118 |
150 // Returns true if the delegate supports speech recognition. | 119 // Returns true if the delegate supports speech recognition. |
151 virtual bool IsSpeechRecognitionEnabled() = 0; | 120 virtual bool IsSpeechRecognitionEnabled() = 0; |
152 | 121 |
153 // Returns the list of users (for AppListMenu). | |
154 virtual const Users& GetUsers() const = 0; | |
155 | |
156 // Returns true if the app list should be centered and in landscape mode. | 122 // Returns true if the app list should be centered and in landscape mode. |
157 virtual bool ShouldCenterWindow() const = 0; | 123 virtual bool ShouldCenterWindow() const = 0; |
158 | 124 |
159 // Adds/removes an observer for profile changes. | |
160 virtual void AddObserver(AppListViewDelegateObserver* observer) {} | |
161 virtual void RemoveObserver(AppListViewDelegateObserver* observer) {} | |
162 | |
163 #if !defined(OS_CHROMEOS) | 125 #if !defined(OS_CHROMEOS) |
164 // Methods to retrieve properties of the message displayed on the app launcher | 126 // Methods to retrieve properties of the message displayed on the app launcher |
165 // above the apps grid. | 127 // above the apps grid. |
166 virtual base::string16 GetMessageTitle() const; | 128 virtual base::string16 GetMessageTitle() const; |
167 // Returns the message text (with the placeholder symbol removed). | 129 // Returns the message text (with the placeholder symbol removed). |
168 // |message_break| is set to the index where the placeholder was in the | 130 // |message_break| is set to the index where the placeholder was in the |
169 // string. | 131 // string. |
170 virtual base::string16 GetMessageText(size_t* message_break) const; | 132 virtual base::string16 GetMessageText(size_t* message_break) const; |
171 virtual base::string16 GetAppsShortcutName() const; | 133 virtual base::string16 GetAppsShortcutName() const; |
172 virtual base::string16 GetLearnMoreText() const; | 134 virtual base::string16 GetLearnMoreText() const; |
173 virtual base::string16 GetLearnMoreLink() const; | 135 virtual base::string16 GetLearnMoreLink() const; |
174 virtual gfx::ImageSkia* GetAppsIcon() const; | 136 virtual gfx::ImageSkia* GetAppsIcon() const; |
175 virtual void OpenLearnMoreLink(); | 137 virtual void OpenLearnMoreLink(); |
176 #endif | 138 #endif |
177 }; | 139 }; |
178 | 140 |
179 } // namespace app_list | 141 } // namespace app_list |
180 | 142 |
181 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 143 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
OLD | NEW |