Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / app_list / app_list_controller_delegate.h
blob0580731f965bfb71e55c9477c11d432da526bb48
1 // Copyright 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 CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_
8 #include <string>
10 #include "chrome/common/extensions/extension_constants.h"
11 #include "extensions/common/constants.h"
12 #include "ui/base/page_transition_types.h"
13 #include "ui/base/window_open_disposition.h"
14 #include "ui/gfx/native_widget_types.h"
16 class Profile;
18 namespace base {
19 class FilePath;
22 namespace extensions {
23 class Extension;
24 class ExtensionSet;
25 class InstallTracker;
28 namespace gfx {
29 class ImageSkia;
30 class Rect;
33 // Interface to allow the view delegate to call out to whatever is controlling
34 // the app list. This will have different implementations for different
35 // platforms.
36 class AppListControllerDelegate {
37 public:
38 // Indicates the source of an app list activation, for tracking purposes.
39 enum AppListSource {
40 LAUNCH_FROM_UNKNOWN,
41 LAUNCH_FROM_APP_LIST,
42 LAUNCH_FROM_APP_LIST_SEARCH
45 // Whether apps can be pinned, and whether pinned apps are editable or fixed.
46 enum Pinnable {
47 NO_PIN,
48 PIN_EDITABLE,
49 PIN_FIXED
52 virtual ~AppListControllerDelegate();
54 // Whether to force the use of a native desktop widget when the app list
55 // window is first created.
56 virtual bool ForceNativeDesktop() const;
58 // Dismisses the view.
59 virtual void DismissView() = 0;
61 // Handle the view being closed.
62 virtual void ViewClosing();
64 // Get app list window.
65 virtual gfx::NativeWindow GetAppListWindow() = 0;
67 // Get the content bounds of the app list in the screen. On platforms that
68 // use views, this returns the bounds of the AppListView. Without views, this
69 // returns a 0x0 rectangle.
70 virtual gfx::Rect GetAppListBounds();
72 // Get the application icon to be used, if any, for the app list.
73 virtual gfx::ImageSkia GetWindowIcon() = 0;
75 // Control of pinning apps.
76 virtual bool IsAppPinned(const std::string& extension_id) = 0;
77 virtual void PinApp(const std::string& extension_id) = 0;
78 virtual void UnpinApp(const std::string& extension_id) = 0;
79 virtual Pinnable GetPinnable() = 0;
81 // Called before and after a dialog opens in the app list. For example,
82 // displays an overlay that disables the app list while the dialog is open.
83 virtual void OnShowChildDialog();
84 virtual void OnCloseChildDialog();
86 // Whether the controller supports a Create Shortcuts flow.
87 virtual bool CanDoCreateShortcutsFlow() = 0;
89 // Show the dialog to create shortcuts. Call only if
90 // CanDoCreateShortcutsFlow() returns true.
91 virtual void DoCreateShortcutsFlow(Profile* profile,
92 const std::string& extension_id) = 0;
94 // Whether the controller supports a Show App Info flow.
95 virtual bool CanDoShowAppInfoFlow();
97 // Show the dialog with the application's information. Call only if
98 // CanDoShowAppInfoFlow() returns true.
99 virtual void DoShowAppInfoFlow(Profile* profile,
100 const std::string& extension_id);
102 // Handle the "create window" context menu items of Chrome App.
103 // |incognito| is true to create an incognito window.
104 virtual void CreateNewWindow(Profile* profile, bool incognito) = 0;
106 // Opens the URL.
107 virtual void OpenURL(Profile* profile,
108 const GURL& url,
109 ui::PageTransition transition,
110 WindowOpenDisposition disposition) = 0;
112 // Show the app's most recent window, or launch it if it is not running.
113 virtual void ActivateApp(Profile* profile,
114 const extensions::Extension* extension,
115 AppListSource source,
116 int event_flags) = 0;
118 // Launch the app.
119 virtual void LaunchApp(Profile* profile,
120 const extensions::Extension* extension,
121 AppListSource source,
122 int event_flags) = 0;
124 // Show the app list for the profile specified by |profile_path|.
125 virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0;
127 // Whether or not the icon indicating which user is logged in should be
128 // visible.
129 virtual bool ShouldShowUserIcon() = 0;
131 static std::string AppListSourceToString(AppListSource source);
133 // True if the user has permission to modify the given app's settings.
134 bool UserMayModifySettings(Profile* profile, const std::string& app_id);
136 // Uninstall the app identified by |app_id| from |profile|.
137 void UninstallApp(Profile* profile, const std::string& app_id);
139 // True if the app was installed from the web store.
140 bool IsAppFromWebStore(Profile* profile,
141 const std::string& app_id);
143 // Shows the user the webstore site for the given app.
144 void ShowAppInWebStore(Profile* profile,
145 const std::string& app_id,
146 bool is_search_result);
148 // True if the given extension has an options page.
149 bool HasOptionsPage(Profile* profile, const std::string& app_id);
151 // Shows the user the options page for the app.
152 void ShowOptionsPage(Profile* profile, const std::string& app_id);
154 // Gets/sets the launch type for an app.
155 // The launch type specifies whether a hosted app should launch as a separate
156 // window, fullscreened or as a tab.
157 extensions::LaunchType GetExtensionLaunchType(
158 Profile* profile, const std::string& app_id);
159 virtual void SetExtensionLaunchType(
160 Profile* profile,
161 const std::string& extension_id,
162 extensions::LaunchType launch_type);
164 // Returns true if the given extension is installed.
165 bool IsExtensionInstalled(Profile* profile, const std::string& app_id);
167 extensions::InstallTracker* GetInstallTrackerFor(Profile* profile);
169 // Get the list of installed apps for the given profile.
170 void GetApps(Profile* profile, extensions::ExtensionSet* out_apps);
172 // Called when a search is started using the app list search box.
173 void OnSearchStarted();
176 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_