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_
10 #include "chrome/common/extensions/extension_constants.h"
11 #include "ui/gfx/native_widget_types.h"
19 namespace extensions
{
29 // Interface to allow the view delegate to call out to whatever is controlling
30 // the app list. This will have different implementations for different
32 class AppListControllerDelegate
{
34 // Indicates the source of an app list activation, for tracking purposes.
38 LAUNCH_FROM_APP_LIST_SEARCH
41 // Whether apps can be pinned, and whether pinned apps are editable or fixed.
48 virtual ~AppListControllerDelegate();
50 // Whether to force the use of a native desktop widget when the app list
51 // window is first created.
52 virtual bool ForceNativeDesktop() const;
54 // Dismisses the view.
55 virtual void DismissView() = 0;
57 // Handle the view being closed.
58 virtual void ViewClosing();
60 // Get app list window.
61 virtual gfx::NativeWindow
GetAppListWindow() = 0;
63 // Get the application icon to be used, if any, for the app list.
64 virtual gfx::ImageSkia
GetWindowIcon() = 0;
66 // Control of pinning apps.
67 virtual bool IsAppPinned(const std::string
& extension_id
) = 0;
68 virtual void PinApp(const std::string
& extension_id
) = 0;
69 virtual void UnpinApp(const std::string
& extension_id
) = 0;
70 virtual Pinnable
GetPinnable() = 0;
72 // Be aware of the extension prompt (either uninstalling flow or enable flow).
73 virtual void OnShowExtensionPrompt();
74 virtual void OnCloseExtensionPrompt();
76 // Whether the controller supports a Create Shortcuts flow.
77 virtual bool CanDoCreateShortcutsFlow() = 0;
79 // Show the dialog to create shortcuts. Call only if
80 // CanDoCreateShortcutsFlow() returns true.
81 virtual void DoCreateShortcutsFlow(Profile
* profile
,
82 const std::string
& extension_id
) = 0;
84 // Handle the "create window" context menu items of Chrome App.
85 // |incognito| is true to create an incognito window.
86 virtual void CreateNewWindow(Profile
* profile
, bool incognito
) = 0;
88 // Show the app's most recent window, or launch it if it is not running.
89 virtual void ActivateApp(Profile
* profile
,
90 const extensions::Extension
* extension
,
95 virtual void LaunchApp(Profile
* profile
,
96 const extensions::Extension
* extension
,
100 // Show the app list for the profile specified by |profile_path|.
101 virtual void ShowForProfileByPath(const base::FilePath
& profile_path
) = 0;
103 // Whether or not the icon indicating which user is logged in should be
105 virtual bool ShouldShowUserIcon() = 0;
107 static std::string
AppListSourceToString(AppListSource source
);
109 // True if the user has permission to modify the given app's settings.
110 bool UserMayModifySettings(Profile
* profile
, const std::string
& app_id
);
112 // Uninstall the app identified by |app_id| from |profile|.
113 void UninstallApp(Profile
* profile
, const std::string
& app_id
);
115 // True if the app was installed from the web store.
116 bool IsAppFromWebStore(Profile
* profile
,
117 const std::string
& app_id
);
119 // Shows the user the webstore site for the given app.
120 void ShowAppInWebStore(Profile
* profile
,
121 const std::string
& app_id
,
122 bool is_search_result
);
124 // True if the given extension has an options page.
125 bool HasOptionsPage(Profile
* profile
, const std::string
& app_id
);
127 // Shows the user the options page for the app.
128 void ShowOptionsPage(Profile
* profile
, const std::string
& app_id
);
130 // Gets/sets the launch type for an app.
131 // The launch type specifies whether a hosted app should launch as a separate
132 // window, fullscreened or as a tab.
133 extensions::LaunchType
GetExtensionLaunchType(
134 Profile
* profile
, const std::string
& app_id
);
135 virtual void SetExtensionLaunchType(
137 const std::string
& extension_id
,
138 extensions::LaunchType launch_type
);
140 // Returns true if the given extension is installed.
141 bool IsExtensionInstalled(Profile
* profile
, const std::string
& app_id
);
143 extensions::InstallTracker
* GetInstallTrackerFor(Profile
* profile
);
145 // Get the list of installed apps for the given profile.
146 void GetApps(Profile
* profile
, extensions::ExtensionSet
* out_apps
);
149 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_