| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ |
| 6 #define ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 class ASH_EXPORT LauncherDelegate { | 39 class ASH_EXPORT LauncherDelegate { |
| 40 public: | 40 public: |
| 41 // Launcher owns the delegate. | 41 // Launcher owns the delegate. |
| 42 virtual ~LauncherDelegate() {} | 42 virtual ~LauncherDelegate() {} |
| 43 | 43 |
| 44 // Invoked when the user clicks on a window entry in the launcher. | 44 // Invoked when the user clicks on a window entry in the launcher. |
| 45 // |event| is the click event. The |event| is dispatched by a view | 45 // |event| is the click event. The |event| is dispatched by a view |
| 46 // and has an instance of |views::View| as the event target | 46 // and has an instance of |views::View| as the event target |
| 47 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed | 47 // but not |aura::Window|. If the |event| is of type KeyEvent, it is assumed |
| 48 // that this was triggered by keyboard action (Alt+<number>) and special | 48 // that this was triggered by keyboard action (Alt+<number>) and special |
| 49 // handling might happen (PerApp launcher). | 49 // handling might happen. |
| 50 virtual void ItemSelected(const LauncherItem& item, | 50 virtual void ItemSelected(const LauncherItem& item, |
| 51 const ui::Event& event) = 0; | 51 const ui::Event& event) = 0; |
| 52 | 52 |
| 53 // Returns the title to display for the specified launcher item. | 53 // Returns the title to display for the specified launcher item. |
| 54 virtual base::string16 GetTitle(const LauncherItem& item) = 0; | 54 virtual base::string16 GetTitle(const LauncherItem& item) = 0; |
| 55 | 55 |
| 56 // Returns the context menumodel for the specified item on | 56 // Returns the context menumodel for the specified item on |
| 57 // |root_window|. Return NULL if there should be no context | 57 // |root_window|. Return NULL if there should be no context |
| 58 // menu. The caller takes ownership of the returned model. | 58 // menu. The caller takes ownership of the returned model. |
| 59 virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item, | 59 virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 85 virtual bool ShouldShowTooltip(const LauncherItem& item) = 0; | 85 virtual bool ShouldShowTooltip(const LauncherItem& item) = 0; |
| 86 | 86 |
| 87 // Callback used to allow delegate to perform initialization actions that | 87 // Callback used to allow delegate to perform initialization actions that |
| 88 // depend on the Launcher being in a known state. | 88 // depend on the Launcher being in a known state. |
| 89 virtual void OnLauncherCreated(Launcher* launcher) = 0; | 89 virtual void OnLauncherCreated(Launcher* launcher) = 0; |
| 90 | 90 |
| 91 // Callback used to inform the delegate that a specific launcher no longer | 91 // Callback used to inform the delegate that a specific launcher no longer |
| 92 // exists. | 92 // exists. |
| 93 virtual void OnLauncherDestroyed(Launcher* launcher) = 0; | 93 virtual void OnLauncherDestroyed(Launcher* launcher) = 0; |
| 94 | 94 |
| 95 // True if the running launcher is the per application launcher. | |
| 96 virtual bool IsPerAppLauncher() = 0; | |
| 97 | |
| 98 // Get the launcher ID from an application ID. | 95 // Get the launcher ID from an application ID. |
| 99 virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0; | 96 virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0; |
| 100 | 97 |
| 101 // Pins an app with |app_id| to launcher. A running instance will get pinned. | 98 // Pins an app with |app_id| to launcher. A running instance will get pinned. |
| 102 // In case there is no running instance a new launcher item is created and | 99 // In case there is no running instance a new launcher item is created and |
| 103 // pinned. | 100 // pinned. |
| 104 virtual void PinAppWithID(const std::string& app_id) = 0; | 101 virtual void PinAppWithID(const std::string& app_id) = 0; |
| 105 | 102 |
| 106 // Check if the app with |app_id_| is pinned to the launcher. | 103 // Check if the app with |app_id_| is pinned to the launcher. |
| 107 virtual bool IsAppPinned(const std::string& app_id) = 0; | 104 virtual bool IsAppPinned(const std::string& app_id) = 0; |
| 108 | 105 |
| 109 // Unpins any app item(s) whose id is |app_id|. The new launcher will collect | 106 // Unpins any app item(s) whose id is |app_id|. The new launcher will collect |
| 110 // all items under one item, the old launcher might have multiple items. | 107 // all items under one item, the old launcher might have multiple items. |
| 111 virtual void UnpinAppsWithID(const std::string& app_id) = 0; | 108 virtual void UnpinAppsWithID(const std::string& app_id) = 0; |
| 112 }; | 109 }; |
| 113 | 110 |
| 114 } // namespace ash | 111 } // namespace ash |
| 115 | 112 |
| 116 #endif // ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ | 113 #endif // ASH_LAUNCHER_LAUNCHER_DELEGATE_H_ |
| OLD | NEW |