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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 enum Type { | 36 enum Type { |
37 TYPE_APP, | 37 TYPE_APP, |
38 TYPE_APP_PANEL, | 38 TYPE_APP_PANEL, |
39 TYPE_SHORTCUT, | 39 TYPE_SHORTCUT, |
40 TYPE_WINDOWED_APP | 40 TYPE_WINDOWED_APP |
41 }; | 41 }; |
42 | 42 |
43 LauncherItemController(Type type, | 43 LauncherItemController(Type type, |
44 const std::string& app_id, | 44 const std::string& app_id, |
| 45 const std::string& launch_id, |
45 ChromeLauncherController* launcher_controller); | 46 ChromeLauncherController* launcher_controller); |
46 ~LauncherItemController() override; | 47 ~LauncherItemController() override; |
47 | 48 |
48 Type type() const { return type_; } | 49 Type type() const { return type_; } |
49 ash::ShelfID shelf_id() const { return shelf_id_; } | 50 ash::ShelfID shelf_id() const { return shelf_id_; } |
50 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } | 51 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } |
51 const std::string& app_id() const { return app_id_; } | 52 const std::string& app_id() const { return app_id_; } |
| 53 const std::string& launch_id() const { return launch_id_; } |
52 ChromeLauncherController* launcher_controller() const { | 54 ChromeLauncherController* launcher_controller() const { |
53 return launcher_controller_; | 55 return launcher_controller_; |
54 } | 56 } |
55 | 57 |
56 // Lock this item to the launcher without being pinned (windowed v1 apps). | 58 // Lock this item to the launcher without being pinned (windowed v1 apps). |
57 void lock() { locked_++; } | 59 void lock() { locked_++; } |
58 void unlock() { | 60 void unlock() { |
59 DCHECK(locked_); | 61 DCHECK(locked_); |
60 locked_--; | 62 locked_--; |
61 } | 63 } |
(...skipping 21 matching lines...) Expand all Loading... |
83 // Called to retrieve the list of running applications. | 85 // Called to retrieve the list of running applications. |
84 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; | 86 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; |
85 | 87 |
86 // Helper function to get the ash::ShelfItemType for the item type. | 88 // Helper function to get the ash::ShelfItemType for the item type. |
87 ash::ShelfItemType GetShelfItemType() const; | 89 ash::ShelfItemType GetShelfItemType() const; |
88 | 90 |
89 private: | 91 private: |
90 const Type type_; | 92 const Type type_; |
91 // App id will be empty if there is no app associated with the window. | 93 // App id will be empty if there is no app associated with the window. |
92 const std::string app_id_; | 94 const std::string app_id_; |
| 95 // An id that can be passed to an app when launched in order to support |
| 96 // multiple shelf items per app. This id is used together with the app_id to |
| 97 // uniquely identify each shelf item that has the same app_id. |
| 98 const std::string launch_id_; |
| 99 // A unique id assigned by the shelf model for the shelf item. |
93 ash::ShelfID shelf_id_; | 100 ash::ShelfID shelf_id_; |
94 ChromeLauncherController* launcher_controller_; | 101 ChromeLauncherController* launcher_controller_; |
95 | 102 |
96 // The lock counter which tells the launcher if the item can be removed from | 103 // The lock counter which tells the launcher if the item can be removed from |
97 // the launcher (0) or not (>0). It is being used for windowed V1 | 104 // the launcher (0) or not (>0). It is being used for windowed V1 |
98 // applications. | 105 // applications. |
99 int locked_; | 106 int locked_; |
100 | 107 |
101 // Set to true if the launcher item image has been set by the controller. | 108 // Set to true if the launcher item image has been set by the controller. |
102 bool image_set_by_controller_; | 109 bool image_set_by_controller_; |
103 | 110 |
104 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); | 111 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); |
105 }; | 112 }; |
106 | 113 |
107 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 114 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
OLD | NEW |