OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H
_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H
_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H
_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H
_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" |
13 | 13 |
| 14 class ArcAppWindow; |
| 15 class ChromeLauncherController; |
| 16 |
14 // Shelf item delegate for ARC app windows. | 17 // Shelf item delegate for ARC app windows. |
15 class ArcAppWindowLauncherItemController | 18 class ArcAppWindowLauncherItemController |
16 : public AppWindowLauncherItemController { | 19 : public AppWindowLauncherItemController { |
17 public: | 20 public: |
18 explicit ArcAppWindowLauncherItemController(const std::string& arc_app_id); | 21 ArcAppWindowLauncherItemController(const std::string& arc_app_id, |
| 22 ChromeLauncherController* owner); |
19 | 23 |
20 ~ArcAppWindowLauncherItemController() override; | 24 ~ArcAppWindowLauncherItemController() override; |
21 | 25 |
22 // AppWindowLauncherItemController overrides: | 26 // AppWindowLauncherItemController overrides: |
23 void ItemSelected(std::unique_ptr<ui::Event> event, | 27 void ItemSelected(std::unique_ptr<ui::Event> event, |
24 int64_t display_id, | 28 int64_t display_id, |
25 ash::ShelfLaunchSource source, | 29 ash::ShelfLaunchSource source, |
26 ItemSelectedCallback callback) override; | 30 ItemSelectedCallback callback) override; |
27 ash::MenuItemList GetAppMenuItems(int event_flags) override; | 31 ash::MenuItemList GetAppMenuItems(int event_flags) override; |
28 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; | 32 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; |
29 | 33 |
30 void AddTaskId(int task_id); | 34 void AddTaskId(int task_id); |
31 void RemoveTaskId(int task_id); | 35 void RemoveTaskId(int task_id); |
32 bool HasAnyTasks() const; | 36 bool HasAnyTasks() const; |
33 | 37 |
| 38 void OnWindowChanged(ArcAppWindow* arc_app_window); |
| 39 |
34 private: | 40 private: |
| 41 // Updates controller icon from the active window. If custom icon of the |
| 42 // window exists and decoded then set this custom icon for the controller. |
| 43 // If not and controller has custom icon set then update the icon from default |
| 44 // AppIconLoader. |
| 45 void UpdateIcon(ArcAppWindow* arc_app_window); |
| 46 |
| 47 // AppWindowLauncherItemController: |
| 48 void OnActiveWindowChanged(ui::BaseWindow* active_window) override; |
| 49 |
35 std::unordered_set<int> task_ids_; | 50 std::unordered_set<int> task_ids_; |
36 | 51 |
| 52 // Unowned property. |
| 53 ChromeLauncherController* const owner_; |
| 54 |
37 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherItemController); | 55 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherItemController); |
38 }; | 56 }; |
39 | 57 |
40 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLE
R_H_ | 58 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_ITEM_CONTROLLE
R_H_ |
OLD | NEW |