| 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_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const std::string& package_name, | 78 const std::string& package_name, |
| 79 const std::string& activity) override; | 79 const std::string& activity) override; |
| 80 void OnTaskDestroyed(int task_id) override; | 80 void OnTaskDestroyed(int task_id) override; |
| 81 void OnTaskSetActive(int32_t task_id) override; | 81 void OnTaskSetActive(int32_t task_id) override; |
| 82 void OnTaskOrientationLockRequested( | 82 void OnTaskOrientationLockRequested( |
| 83 int32_t task_id, | 83 int32_t task_id, |
| 84 const arc::mojom::OrientationLock orientation_lock) override; | 84 const arc::mojom::OrientationLock orientation_lock) override; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 class AppWindow; | 87 class AppWindow; |
| 88 class AppWindowInfo; |
| 88 | 89 |
| 89 using TaskIdToAppWindow = std::map<int, std::unique_ptr<AppWindow>>; | 90 using TaskIdToAppWindowInfo = std::map<int, std::unique_ptr<AppWindowInfo>>; |
| 90 using TaskIdToShelfAppIdMap = std::map<int, std::string>; | 91 using ShelfAppIdToAppControllerMap = |
| 91 using AppControllerMap = | |
| 92 std::map<std::string, ArcAppWindowLauncherItemController*>; | 92 std::map<std::string, ArcAppWindowLauncherItemController*>; |
| 93 | 93 |
| 94 void StartObserving(Profile* profile); | 94 void StartObserving(Profile* profile); |
| 95 void StopObserving(Profile* profile); | 95 void StopObserving(Profile* profile); |
| 96 | 96 |
| 97 void RegisterApp(AppWindow* app_window); | 97 void RegisterApp(AppWindowInfo* app_window_info); |
| 98 void UnregisterApp(AppWindow* app_window, bool close_controller); | 98 void UnregisterApp(AppWindowInfo* app_window_info, bool close_controller); |
| 99 | 99 |
| 100 AppWindowInfo* GetAppWindowInfoForTask(int task_id); |
| 100 AppWindow* GetAppWindowForTask(int task_id); | 101 AppWindow* GetAppWindowForTask(int task_id); |
| 101 | 102 |
| 102 void AttachControllerToWindowIfNeeded(aura::Window* window); | 103 void AttachControllerToWindowIfNeeded(aura::Window* window); |
| 103 void AttachControllerToWindowsIfNeeded(); | 104 void AttachControllerToWindowsIfNeeded(); |
| 104 ArcAppWindowLauncherItemController* AttachControllerToTask( | 105 ArcAppWindowLauncherItemController* AttachControllerToTask( |
| 105 const std::string& shelf_app_id, | 106 const std::string& shelf_app_id, |
| 106 int taskId); | 107 int taskId); |
| 107 | 108 |
| 108 void SetOrientationLockForAppWindow(AppWindow* app_window); | 109 void SetOrientationLockForAppWindow(AppWindow* app_window); |
| 109 | 110 |
| 110 // AppWindowLauncherController: | 111 // AppWindowLauncherController: |
| 111 AppWindowLauncherItemController* ControllerForWindow( | 112 AppWindowLauncherItemController* ControllerForWindow( |
| 112 aura::Window* window) override; | 113 aura::Window* window) override; |
| 113 | 114 |
| 114 // Not owned | 115 // Not owned |
| 115 ash::ShelfDelegate* shelf_delegate_; | 116 ash::ShelfDelegate* shelf_delegate_; |
| 116 int active_task_id_ = -1; | 117 int active_task_id_ = -1; |
| 117 TaskIdToAppWindow task_id_to_app_window_; | 118 TaskIdToAppWindowInfo task_id_to_app_window_info_; |
| 118 TaskIdToShelfAppIdMap task_id_to_shelf_app_id_; | 119 ShelfAppIdToAppControllerMap app_controller_map_; |
| 119 AppControllerMap app_controller_map_; | |
| 120 std::vector<aura::Window*> observed_windows_; | 120 std::vector<aura::Window*> observed_windows_; |
| 121 Profile* observed_profile_ = nullptr; | 121 Profile* observed_profile_ = nullptr; |
| 122 bool observing_shell_ = false; | 122 bool observing_shell_ = false; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController); | 124 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ | 127 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |