Paint state transition for overlay 9 patch scrollbars
[chromium-blink-merge.git] / ui / app_list / app_list_view_delegate.h
blobcf6fa53efe6c8428cf689b549def282c83d440ce
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 gfx {
22 class ImageSkia;
23 class Size;
26 #if defined(TOOLKIT_VIEWS)
27 namespace views {
28 class View;
30 #endif
32 namespace app_list {
34 class AppListModel;
35 class AppListViewDelegateObserver;
36 class SearchResult;
37 class SpeechUIModel;
39 class APP_LIST_EXPORT AppListViewDelegate {
40 public:
41 // A user of the app list.
42 struct APP_LIST_EXPORT User {
43 User();
44 ~User();
46 // Whether or not this user is the current user of the app list.
47 bool active;
49 // The name of this user.
50 base::string16 name;
52 // The email address of this user.
53 base::string16 email;
55 // The path to this user's profile directory.
56 base::FilePath profile_path;
58 typedef std::vector<User> Users;
60 // AppListView owns the delegate.
61 virtual ~AppListViewDelegate() {}
63 // Whether to force the use of a native desktop widget when the app list
64 // window is first created.
65 virtual bool ForceNativeDesktop() const = 0;
67 // Sets the delegate to use the profile at |profile_path|. This is currently
68 // only used by non-Ash Windows.
69 virtual void SetProfileByPath(const base::FilePath& profile_path) = 0;
71 // 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).
73 virtual AppListModel* GetModel() = 0;
75 // Gets the SpeechUIModel for the app list. Owned by the AppListViewDelegate.
76 virtual SpeechUIModel* GetSpeechUI() = 0;
78 // Gets a path to a shortcut for the given app. Returns asynchronously as the
79 // shortcut may not exist yet.
80 virtual void GetShortcutPathForApp(
81 const std::string& app_id,
82 const base::Callback<void(const base::FilePath&)>& callback) = 0;
84 // Invoked to start a new search. Delegate collects query input from
85 // SearchBoxModel and populates SearchResults. Both models are sub models
86 // of AppListModel.
87 virtual void StartSearch() = 0;
89 // Invoked to stop the current search.
90 virtual void StopSearch() = 0;
92 // Invoked to open the search result.
93 virtual void OpenSearchResult(SearchResult* result,
94 bool auto_launch,
95 int event_flags) = 0;
97 // Called to invoke a custom action on |result|. |action_index| corresponds
98 // to the index of an icon in |result.action_icons()|.
99 virtual void InvokeSearchResultAction(SearchResult* result,
100 int action_index,
101 int event_flags) = 0;
103 // Gets the timeout for auto-launching the first search result, or 0 if the
104 // auto-launch should not happen for the current search session.
105 virtual base::TimeDelta GetAutoLaunchTimeout() = 0;
107 // Invoked when the auto-launch is canceled by the user action.
108 virtual void AutoLaunchCanceled() = 0;
110 // Invoked when the app list UI is created.
111 virtual void ViewInitialized() = 0;
113 // Invoked to dismiss app list. This may leave the view open but hidden from
114 // the user.
115 virtual void Dismiss() = 0;
117 // Invoked when the app list is closing.
118 virtual void ViewClosing() = 0;
120 // Returns the icon to be displayed in the window and taskbar.
121 virtual gfx::ImageSkia GetWindowIcon() = 0;
123 // Open the settings UI.
124 virtual void OpenSettings() = 0;
126 // Open the help UI.
127 virtual void OpenHelp() = 0;
129 // Open the feedback UI.
130 virtual void OpenFeedback() = 0;
132 // Invoked to toggle the status of speech recognition.
133 virtual void ToggleSpeechRecognition() = 0;
135 // Shows the app list for the profile specified by |profile_path|.
136 virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0;
138 #if defined(TOOLKIT_VIEWS)
139 // Creates the web view for the start page. The caller takes the ownership of
140 // the returned view.
141 virtual views::View* CreateStartPageWebView(const gfx::Size& size) = 0;
142 #endif
144 // Returns true if the delegate supports speech recognition.
145 virtual bool IsSpeechRecognitionEnabled() = 0;
147 // Returns the list of users (for AppListMenu).
148 virtual const Users& GetUsers() const = 0;
150 // Returns true if the app list should be centered and in landscape mode.
151 virtual bool ShouldCenterWindow() const = 0;
153 // Adds/removes an observer for profile changes.
154 virtual void AddObserver(AppListViewDelegateObserver* observer) {}
155 virtual void RemoveObserver(AppListViewDelegateObserver* observer) {}
158 } // namespace app_list
160 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_