app_list_controller_delegate.h revision 8bcbed890bc3ce4d7a057a8f32cab53fa534672e
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  // Whether apps can be pinned, and whether pinned apps are editable or fixed.
39  enum Pinnable {
40    NO_PIN,
41    PIN_EDITABLE,
42    PIN_FIXED
43  };
44
45  virtual ~AppListControllerDelegate();
46
47  // Dismisses the view.
48  virtual void DismissView() = 0;
49
50  // Handle the view being closed.
51  virtual void ViewClosing();
52
53  // Get app list window.
54  virtual gfx::NativeWindow GetAppListWindow() = 0;
55
56  // Get the application icon to be used, if any, for the app list.
57  virtual gfx::ImageSkia GetWindowIcon();
58
59  // Control of pinning apps.
60  virtual bool IsAppPinned(const std::string& extension_id);
61  virtual void PinApp(const std::string& extension_id);
62  virtual void UnpinApp(const std::string& extension_id);
63  virtual Pinnable GetPinnable() = 0;
64
65  // Be aware of the extension prompt (either uninstalling flow or enable flow).
66  virtual void OnShowExtensionPrompt() {}
67  virtual void OnCloseExtensionPrompt() {}
68
69  // Whether the controller supports a Create Shortcuts flow.
70  virtual bool CanDoCreateShortcutsFlow();
71
72  // Show the dialog to create shortcuts. Call only if
73  // CanDoCreateShortcutsFlow() returns true.
74  void DoCreateShortcutsFlow(Profile* profile, const std::string& extension_id);
75
76  // Handle the "create window" context menu items of Chrome App.
77  // |incognito| is true to create an incognito window.
78  virtual void CreateNewWindow(Profile* profile, bool incognito);
79
80  // Show the app's most recent window, or launch it if it is not running.
81  virtual void ActivateApp(Profile* profile,
82                           const extensions::Extension* extension,
83                           AppListSource source,
84                           int event_flags) = 0;
85
86  // Launch the app.
87  virtual void LaunchApp(Profile* profile,
88                         const extensions::Extension* extension,
89                         AppListSource source,
90                         int event_flags) = 0;
91
92  // Show the app list for the profile specified by |profile_path|.
93  virtual void ShowForProfileByPath(const base::FilePath& profile_path) = 0;
94
95  // Whether or not the icon indicating which user is logged in should be
96  // visible.
97  virtual bool ShouldShowUserIcon();
98
99  static std::string AppListSourceToString(AppListSource source);
100};
101
102#endif  // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_H_
103