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. 4 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_ 7 8 #include <string> 9 10 #include "ui/gfx/native_widget_types.h" 11 12 class Profile; 13 14 namespace extensions { 15 class Extension; 16 } 17 18 namespace gfx { 19 class ImageSkia; 20 } 21 22 // Interface to allow the view delegate to call out to whatever is controlling 23 // the app list. This will have different implementations for different 24 // platforms. 25 class AppListControllerDelegate { 26 public: 27 virtual ~AppListControllerDelegate(); 28 29 // Dismisses the view. 30 virtual void DismissView() = 0; 31 32 // Handle the view being closed. 33 virtual void ViewClosing(); 34 35 // Handle the view being activated or deactivated. 36 virtual void ViewActivationChanged(bool active); 37 38 // Get app list window. 39 virtual gfx::NativeWindow GetAppListWindow() = 0; 40 41 // Get the application icon to be used, if any, for the app list. 42 virtual gfx::ImageSkia GetWindowIcon(); 43 44 // Control of pinning apps. 45 virtual bool IsAppPinned(const std::string& extension_id); 46 virtual void PinApp(const std::string& extension_id); 47 virtual void UnpinApp(const std::string& extension_id); 48 virtual bool CanPin() = 0; 49 50 // Be aware of the extension prompt (either uninstalling flow or enable flow). 51 virtual void OnShowExtensionPrompt() {} 52 virtual void OnCloseExtensionPrompt() {} 53 54 // Whether the controller supports a Create Shortcuts flow. 55 virtual bool CanDoCreateShortcutsFlow(bool is_platform_app) = 0; 56 virtual void DoCreateShortcutsFlow(Profile* profile, 57 const std::string& extension_id); 58 59 // Handle the "create window" context menu items of Chrome App. 60 // |incognito| is true to create an incognito window. 61 virtual void CreateNewWindow(Profile* profile, bool incognito); 62 63 // Show the app's most recent window, or launch it if it is not running. 64 virtual void ActivateApp(Profile* profile, 65 const extensions::Extension* extension, 66 int event_flags) = 0; 67 68 // Launch the app. 69 virtual void LaunchApp(Profile* profile, 70 const extensions::Extension* extension, 71 int event_flags) = 0; 72 73 // Whether or not the icon indicating which user is logged in should be 74 // visible. 75 virtual bool ShouldShowUserIcon(); 76 }; 77 78 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_ 79