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 CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/common/shelf/shelf_item_delegate.h" | 10 #include "ash/common/shelf/shelf_item_delegate.h" |
11 #include "ash/common/shelf/shelf_item_types.h" | 11 #include "ash/common/shelf/shelf_item_types.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" |
15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
16 | 16 |
| 17 class AppWindowLauncherItemController; |
17 class ChromeLauncherController; | 18 class ChromeLauncherController; |
18 class ChromeLauncherAppMenuItem; | 19 class ChromeLauncherAppMenuItem; |
19 | 20 |
20 using ChromeLauncherAppMenuItems = | 21 using ChromeLauncherAppMenuItems = |
21 std::vector<std::unique_ptr<ChromeLauncherAppMenuItem>>; | 22 std::vector<std::unique_ptr<ChromeLauncherAppMenuItem>>; |
22 | 23 |
23 // LauncherItemController is used by ChromeLauncherController to track one | 24 // LauncherItemController is used by ChromeLauncherController to track one |
24 // or more windows associated with a shelf item. | 25 // or more windows associated with a shelf item. |
25 class LauncherItemController : public ash::ShelfItemDelegate { | 26 class LauncherItemController : public ash::ShelfItemDelegate { |
26 public: | 27 public: |
(...skipping 30 matching lines...) Expand all Loading... |
57 virtual void Launch(ash::LaunchSource source, int event_flags) = 0; | 58 virtual void Launch(ash::LaunchSource source, int event_flags) = 0; |
58 | 59 |
59 // Shows and activates the most-recently-active window associated with the | 60 // Shows and activates the most-recently-active window associated with the |
60 // item, or launches the item if it is not currently open. | 61 // item, or launches the item if it is not currently open. |
61 // Returns the action performed by activating the item. | 62 // Returns the action performed by activating the item. |
62 virtual PerformedAction Activate(ash::LaunchSource source) = 0; | 63 virtual PerformedAction Activate(ash::LaunchSource source) = 0; |
63 | 64 |
64 // Called to retrieve the list of running applications. | 65 // Called to retrieve the list of running applications. |
65 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; | 66 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; |
66 | 67 |
| 68 // Returns nullptr if class is not AppWindowLauncherItemController. |
| 69 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController(); |
| 70 |
67 private: | 71 private: |
68 // The application id; empty if there is no app associated with the item. | 72 // The application id; empty if there is no app associated with the item. |
69 const std::string app_id_; | 73 const std::string app_id_; |
70 | 74 |
71 // An id that can be passed to an app when launched in order to support | 75 // An id that can be passed to an app when launched in order to support |
72 // multiple shelf items per app. This id is used together with the app_id to | 76 // multiple shelf items per app. This id is used together with the app_id to |
73 // uniquely identify each shelf item that has the same app_id. | 77 // uniquely identify each shelf item that has the same app_id. |
74 const std::string launch_id_; | 78 const std::string launch_id_; |
75 | 79 |
76 // A unique id assigned by the shelf model for the shelf item. | 80 // A unique id assigned by the shelf model for the shelf item. |
77 ash::ShelfID shelf_id_; | 81 ash::ShelfID shelf_id_; |
78 | 82 |
79 ChromeLauncherController* launcher_controller_; | 83 ChromeLauncherController* launcher_controller_; |
80 | 84 |
81 // The lock counter which tells the launcher if the item can be removed from | 85 // The lock counter which tells the launcher if the item can be removed from |
82 // the launcher (0) or not (>0). It is being used for windowed V1 | 86 // the launcher (0) or not (>0). It is being used for windowed V1 |
83 // applications. | 87 // applications. |
84 int locked_; | 88 int locked_; |
85 | 89 |
86 // Set to true if the launcher item image has been set by the controller. | 90 // Set to true if the launcher item image has been set by the controller. |
87 bool image_set_by_controller_; | 91 bool image_set_by_controller_; |
88 | 92 |
89 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); | 93 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); |
90 }; | 94 }; |
91 | 95 |
92 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 96 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
OLD | NEW |