Revert of Removing Chrome Gamepad transition cruft (https://codereview.chromium.org...
[chromium-blink-merge.git] / ui / app_list / app_list_view_delegate.h
blobaac3f35e026a78cb28ce12a21c690832b9232961
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
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
6 #define UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback_forward.h"
12 #include "base/files/file_path.h"
13 #include "base/strings/string16.h"
14 #include "base/time/time.h"
15 #include "ui/app_list/app_list_export.h"
17 namespace base {
18 class FilePath;
21 namespace content {
22 class WebContents;
25 namespace gfx {
26 class ImageSkia;
29 namespace app_list {
31 class AppListModel;
32 class AppListViewDelegateObserver;
33 class SearchResult;
34 class SigninDelegate;
35 class SpeechUIModel;
37 class APP_LIST_EXPORT AppListViewDelegate {
38 public:
39 // A user of the app list.
40 struct APP_LIST_EXPORT User {
41 User();
42 ~User();
44 // Whether or not this user is the current user of the app list.
45 bool active;
47 // The name of this user.
48 base::string16 name;
50 // The email address of this user.
51 base::string16 email;
53 // The path to this user's profile directory.
54 base::FilePath profile_path;
56 typedef std::vector<User> Users;
58 // AppListView owns the delegate.
59 virtual ~AppListViewDelegate() {}
61 // Whether to force the use of a native desktop widget when the app list
62 // window is first created.
63 virtual bool ForceNativeDesktop() const = 0;
65 // Sets the delegate to use the profile at |profile_path|. This is currently
66 // only used by non-Ash Windows.
67 virtual void SetProfileByPath(const base::FilePath& profile_path) = 0;
69 // Gets the model associated with the view delegate. The model may be owned
70 // by the delegate, or owned elsewhere (e.g. a profile keyed service).
71 virtual AppListModel* GetModel() = 0;
73 // Gets the SigninDelegate for the app list. Owned by the AppListViewDelegate.
74 virtual SigninDelegate* GetSigninDelegate() = 0;
76 // Gets the SpeechUIModel for the app list. Owned by the AppListViewDelegate.
77 virtual SpeechUIModel* GetSpeechUI() = 0;
79 // Gets a path to a shortcut for the given app. Returns asynchronously as the
80 // shortcut may not exist yet.
81 virtual void GetShortcutPathForApp(
82 const std::string& app_id,
83 const base::Callback<void(const base::FilePath&)>& callback) = 0;
85 // Invoked to start a new search. Delegate collects query input from
86 // SearchBoxModel and populates SearchResults. Both models are sub models
87 // of AppListModel.
88 virtual void StartSearch() = 0;
90 // Invoked to stop the current search.
91 virtual void StopSearch() = 0;
93 // Invoked to open the search result.
94 virtual void OpenSearchResult(SearchResult* result,
95 bool auto_launch,
96 int event_flags) = 0;
98 // Called to invoke a custom action on |result|. |action_index| corresponds
99 // to the index of an icon in |result.action_icons()|.
100 virtual void InvokeSearchResultAction(SearchResult* result,
101 int action_index,
102 int event_flags) = 0;
104 // Gets the timeout for auto-launching the first search result, or 0 if the
105 // auto-launch should not happen for the current search session.
106 virtual base::TimeDelta GetAutoLaunchTimeout() = 0;
108 // Invoked when the auto-launch is canceled by the user action.
109 virtual void AutoLaunchCanceled() = 0;
111 // Invoked when the app list UI is created.
112 virtual void ViewInitialized() = 0;
114 // Invoked to dismiss app list. This may leave the view open but hidden from
115 // the user.
116 virtual void Dismiss() = 0;
118 // Invoked when the app list is closing.
119 virtual void ViewClosing() = 0;
121 // Returns the icon to be displayed in the window and taskbar.
122 virtual gfx::ImageSkia GetWindowIcon() = 0;
124 // Open the settings UI.
125 virtual void OpenSettings() = 0;
127 // Open the help UI.
128 virtual void OpenHelp() = 0;
130 // Open the feedback UI.
131 virtual void OpenFeedback() = 0;
133 // Invoked to toggle the status of speech recognition.
134 virtual void ToggleSpeechRecognition() = 0;
136 // Shows the app list for the profile specified by |profile_path|.
137 virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0;
139 // Get the start page web contents. Owned by the AppListViewDelegate.
140 virtual content::WebContents* GetStartPageContents() = 0;
142 // Get the web contents for speech recognition or NULL if speech recognition
143 // is unavailable.
144 virtual content::WebContents* GetSpeechRecognitionContents() = 0;
146 // Returns the list of users (for AppListMenu).
147 virtual const Users& GetUsers() const = 0;
149 // Adds/removes an observer for profile changes.
150 virtual void AddObserver(AppListViewDelegateObserver* observer) {}
151 virtual void RemoveObserver(AppListViewDelegateObserver* observer) {}
154 } // namespace app_list
156 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_