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/public/cpp/app_launch_id.h" | 10 #include "ash/public/cpp/app_launch_id.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 ash::ShelfID shelf_id() const { return shelf_id_; } | 30 ash::ShelfID shelf_id() const { return shelf_id_; } |
31 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } | 31 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } |
32 const ash::AppLaunchId& app_launch_id() const { return app_launch_id_; } | 32 const ash::AppLaunchId& app_launch_id() const { return app_launch_id_; } |
33 const std::string& app_id() const { return app_launch_id_.app_id(); } | 33 const std::string& app_id() const { return app_launch_id_.app_id(); } |
34 const std::string& launch_id() const { return app_launch_id_.launch_id(); } | 34 const std::string& launch_id() const { return app_launch_id_.launch_id(); } |
35 ChromeLauncherController* launcher_controller() const { | 35 ChromeLauncherController* launcher_controller() const { |
36 return launcher_controller_; | 36 return launcher_controller_; |
37 } | 37 } |
38 | 38 |
39 // Lock this item to the launcher without being pinned (windowed v1 apps). | |
40 void lock() { locked_++; } | |
41 void unlock() { | |
42 DCHECK(locked_); | |
43 locked_--; | |
44 } | |
45 bool locked() const { return locked_ > 0; } | |
46 | |
47 bool image_set_by_controller() const { return image_set_by_controller_; } | 39 bool image_set_by_controller() const { return image_set_by_controller_; } |
48 void set_image_set_by_controller(bool image_set_by_controller) { | 40 void set_image_set_by_controller(bool image_set_by_controller) { |
49 image_set_by_controller_ = image_set_by_controller; | 41 image_set_by_controller_ = image_set_by_controller; |
50 } | 42 } |
51 | 43 |
52 // Returns items for the application menu; used for convenience and testing. | 44 // Returns items for the application menu; used for convenience and testing. |
53 virtual MenuItemList GetAppMenuItems(int event_flags); | 45 virtual MenuItemList GetAppMenuItems(int event_flags); |
54 | 46 |
55 // Returns nullptr if class is not AppWindowLauncherItemController. | 47 // Returns nullptr if class is not AppWindowLauncherItemController. |
56 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController(); | 48 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController(); |
57 | 49 |
58 private: | 50 private: |
59 // The app launch id; empty if there is no app associated with the item. | 51 // The app launch id; empty if there is no app associated with the item. |
60 // Besides the application id, AppLaunchId also contains a launch id, which is | 52 // Besides the application id, AppLaunchId also contains a launch id, which is |
61 // an id that can be passed to an app when launched in order to support | 53 // an id that can be passed to an app when launched in order to support |
62 // multiple shelf items per app. This id is used together with the app_id to | 54 // multiple shelf items per app. This id is used together with the app_id to |
63 // uniquely identify each shelf item that has the same app_id. | 55 // uniquely identify each shelf item that has the same app_id. |
64 const ash::AppLaunchId app_launch_id_; | 56 const ash::AppLaunchId app_launch_id_; |
65 | 57 |
66 // A unique id assigned by the shelf model for the shelf item. | 58 // A unique id assigned by the shelf model for the shelf item. |
67 ash::ShelfID shelf_id_; | 59 ash::ShelfID shelf_id_; |
68 | 60 |
69 ChromeLauncherController* launcher_controller_; | 61 ChromeLauncherController* launcher_controller_; |
70 | 62 |
71 // The lock counter which tells the launcher if the item can be removed from | |
72 // the launcher (0) or not (>0). It is being used for windowed V1 | |
73 // applications. | |
74 int locked_; | |
75 | |
76 // Set to true if the launcher item image has been set by the controller. | 63 // Set to true if the launcher item image has been set by the controller. |
77 bool image_set_by_controller_; | 64 bool image_set_by_controller_; |
78 | 65 |
79 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); | 66 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); |
80 }; | 67 }; |
81 | 68 |
82 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 69 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
OLD | NEW |