Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / app_list_controller_delegate.h
blob7ea9da9308cee12243fce0bd653cc902beeeff0f
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 "ui/gfx/native_widget_types.h"
13 class Profile;
15 namespace base {
16 class FilePath;
19 namespace extensions {
20 class Extension;
21 class ExtensionSet;
22 class InstallTracker;
25 namespace gfx {
26 class ImageSkia;
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
31 // platforms.
32 class AppListControllerDelegate {
33 public:
34 // Indicates the source of an app list activation, for tracking purposes.
35 enum AppListSource {
36 LAUNCH_FROM_UNKNOWN,
37 LAUNCH_FROM_APP_LIST,
38 LAUNCH_FROM_APP_LIST_SEARCH
41 // Whether apps can be pinned, and whether pinned apps are editable or fixed.
42 enum Pinnable {
43 NO_PIN,
44 PIN_EDITABLE,
45 PIN_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,
91 AppListSource source,
92 int event_flags) = 0;
94 // Launch the app.
95 virtual void LaunchApp(Profile* profile,
96 const extensions::Extension* extension,
97 AppListSource source,
98 int event_flags) = 0;
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
104 // visible.
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(
136 Profile* profile,
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_