app_list_controller_delegate.h revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
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 12class Profile; 13 14namespace base { 15class FilePath; 16} 17 18namespace extensions { 19class Extension; 20} 21 22namespace gfx { 23class ImageSkia; 24} 25 26// Interface to allow the view delegate to call out to whatever is controlling 27// the app list. This will have different implementations for different 28// platforms. 29class AppListControllerDelegate { 30 public: 31 // Indicates the source of an app list activation, for tracking purposes. 32 enum AppListSource { 33 LAUNCH_FROM_UNKNOWN, 34 LAUNCH_FROM_APP_LIST, 35 LAUNCH_FROM_APP_LIST_SEARCH 36 }; 37 38 virtual ~AppListControllerDelegate(); 39 40 // Dismisses the view. 41 virtual void DismissView() = 0; 42 43 // Handle the view being closed. 44 virtual void ViewClosing(); 45 46 // Get app list window. 47 virtual gfx::NativeWindow GetAppListWindow() = 0; 48 49 // Get the application icon to be used, if any, for the app list. 50 virtual gfx::ImageSkia GetWindowIcon(); 51 52 // Control of pinning apps. 53 virtual bool IsAppPinned(const std::string& extension_id); 54 virtual void PinApp(const std::string& extension_id); 55 virtual void UnpinApp(const std::string& extension_id); 56 virtual bool CanPin() = 0; 57 58 // Be aware of the extension prompt (either uninstalling flow or enable flow). 59 virtual void OnShowExtensionPrompt() {} 60 virtual void OnCloseExtensionPrompt() {} 61 62 // Whether the controller supports a Create Shortcuts flow. 63 virtual bool CanDoCreateShortcutsFlow(bool is_platform_app) = 0; 64 virtual void DoCreateShortcutsFlow(Profile* profile, 65 const std::string& extension_id); 66 67 // Handle the "create window" context menu items of Chrome App. 68 // |incognito| is true to create an incognito window. 69 virtual void CreateNewWindow(Profile* profile, bool incognito); 70 71 // Show the app's most recent window, or launch it if it is not running. 72 virtual void ActivateApp(Profile* profile, 73 const extensions::Extension* extension, 74 AppListSource source, 75 int event_flags) = 0; 76 77 // Launch the app. 78 virtual void LaunchApp(Profile* profile, 79 const extensions::Extension* extension, 80 AppListSource source, 81 int event_flags) = 0; 82 83 // Show the app list for the profile specified by |profile_path|. 84 virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0; 85 86 // Whether or not the icon indicating which user is logged in should be 87 // visible. 88 virtual bool ShouldShowUserIcon(); 89 90 static std::string AppListSourceToString(AppListSource source); 91}; 92 93#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_ 94