OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROME_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/display/window_tree_host_manager.h" | 12 #include "ash/display/window_tree_host_manager.h" |
13 #include "ash/public/cpp/shelf_item_delegate.h" | 13 #include "ash/public/cpp/shelf_item_delegate.h" |
14 #include "ash/public/cpp/shelf_types.h" | 14 #include "ash/public/cpp/shelf_types.h" |
15 #include "ash/public/interfaces/shelf.mojom.h" | 15 #include "ash/public/interfaces/shelf.mojom.h" |
16 #include "ash/shelf/shelf_model_observer.h" | 16 #include "ash/shelf/shelf_model_observer.h" |
17 #include "base/auto_reset.h" | 17 #include "base/auto_reset.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "chrome/browser/ui/app_icon_loader_delegate.h" | 20 #include "chrome/browser/ui/app_icon_loader_delegate.h" |
21 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 21 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
22 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 22 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
23 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 23 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
24 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 24 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
25 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" | 25 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" |
26 #include "components/prefs/pref_change_registrar.h" | 26 #include "components/prefs/pref_change_registrar.h" |
27 #include "components/sync_preferences/pref_service_syncable_observer.h" | 27 #include "components/sync_preferences/pref_service_syncable_observer.h" |
28 #include "mojo/public/cpp/bindings/associated_binding.h" | 28 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 29 #include "ui/aura/window.h" |
29 | 30 |
30 class AccountId; | 31 class AccountId; |
31 class AppIconLoader; | 32 class AppIconLoader; |
32 class AppSyncUIState; | 33 class AppSyncUIState; |
33 class AppWindowLauncherController; | 34 class AppWindowLauncherController; |
34 class ArcAppDeferredLauncherController; | 35 class ArcAppDeferredLauncherController; |
35 class BrowserShortcutLauncherItemController; | 36 class BrowserShortcutLauncherItemController; |
36 class BrowserStatusMonitor; | 37 class BrowserStatusMonitor; |
37 class ChromeLauncherControllerUserSwitchObserver; | 38 class ChromeLauncherControllerUserSwitchObserver; |
38 class ChromeLauncherPrefsObserver; | 39 class ChromeLauncherPrefsObserver; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Closes or unpins the shelf item. | 114 // Closes or unpins the shelf item. |
114 void CloseLauncherItem(const ash::ShelfID& id); | 115 void CloseLauncherItem(const ash::ShelfID& id); |
115 | 116 |
116 // Returns true if the item identified by |id| is pinned. | 117 // Returns true if the item identified by |id| is pinned. |
117 bool IsPinned(const ash::ShelfID& id); | 118 bool IsPinned(const ash::ShelfID& id); |
118 | 119 |
119 // Set the shelf item status for the V1 application with the given |app_id|. | 120 // Set the shelf item status for the V1 application with the given |app_id|. |
120 // Adds or removes an item as needed to respect the running and pinned state. | 121 // Adds or removes an item as needed to respect the running and pinned state. |
121 void SetV1AppStatus(const std::string& app_id, ash::ShelfItemStatus status); | 122 void SetV1AppStatus(const std::string& app_id, ash::ShelfItemStatus status); |
122 | 123 |
123 // Requests that the shelf item controller specified by |id| open a new | |
124 // instance of the app. |event_flags| holds the flags of the event which | |
125 // triggered this command. | |
126 void Launch(const ash::ShelfID& id, int event_flags); | |
127 | |
128 // Closes the specified item. | 124 // Closes the specified item. |
129 void Close(const ash::ShelfID& id); | 125 void Close(const ash::ShelfID& id); |
130 | 126 |
131 // Returns true if the specified item is open. | 127 // Returns true if the specified item is open. |
132 bool IsOpen(const ash::ShelfID& id); | 128 bool IsOpen(const ash::ShelfID& id); |
133 | 129 |
134 // Returns true if the specified item is for a platform app. | 130 // Returns true if the specified item is for a platform app. |
135 bool IsPlatformApp(const ash::ShelfID& id); | 131 bool IsPlatformApp(const ash::ShelfID& id); |
136 | 132 |
137 // Opens a new instance of the application identified by the ShelfID. | 133 // Opens a new instance of the application identified by the ShelfID. |
138 // Used by the app-list, and by pinned-app shelf items. | 134 // Used by the app-list, and by pinned-app shelf items. |root_window| is the |
| 135 // root window from which the app is launched. |
139 void LaunchApp(const ash::ShelfID& id, | 136 void LaunchApp(const ash::ShelfID& id, |
140 ash::ShelfLaunchSource source, | 137 ash::ShelfLaunchSource source, |
141 int event_flags); | 138 int event_flags, |
| 139 const aura::Window* root_window); |
142 | 140 |
143 // If |app_id| is running, reactivates the app's most recently active window, | 141 // If |app_id| is running, reactivates the app's most recently active window, |
144 // otherwise launches and activates the app. | 142 // otherwise launches and activates the app. |
145 // Used by the app-list, and by pinned-app shelf items. | 143 // Used by the app-list, and by pinned-app shelf items. |
146 void ActivateApp(const std::string& app_id, | 144 void ActivateApp(const std::string& app_id, |
147 ash::ShelfLaunchSource source, | 145 ash::ShelfLaunchSource source, |
148 int event_flags); | 146 int event_flags); |
149 | 147 |
150 // Set the image for a specific shelf item (e.g. when set by the app). | 148 // Set the image for a specific shelf item (e.g. when set by the app). |
151 void SetLauncherItemImage(const ash::ShelfID& shelf_id, | 149 void SetLauncherItemImage(const ash::ShelfID& shelf_id, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 using RunningAppListIds = std::vector<std::string>; | 439 using RunningAppListIds = std::vector<std::string>; |
442 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; | 440 using RunningAppListIdMap = std::map<std::string, RunningAppListIds>; |
443 RunningAppListIdMap last_used_running_application_order_; | 441 RunningAppListIdMap last_used_running_application_order_; |
444 | 442 |
445 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; | 443 base::WeakPtrFactory<ChromeLauncherController> weak_ptr_factory_; |
446 | 444 |
447 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 445 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
448 }; | 446 }; |
449 | 447 |
450 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 448 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |