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_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "apps/app_window_registry.h" | 12 #include "apps/app_window_registry.h" |
13 #include "ui/aura/client/activation_change_observer.h" | 13 #include "ui/aura/client/activation_change_observer.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 | 15 |
16 namespace apps { | 16 namespace apps { |
17 class AppWindow; | 17 class AppWindow; |
18 } | 18 } |
19 | 19 |
20 namespace aura { | 20 namespace aura { |
21 | 21 |
22 class Window; | 22 class Window; |
23 | 23 |
24 namespace client { | 24 namespace client { |
25 class ActivationClient; | 25 class ActivationClient; |
26 } | 26 } |
27 | |
28 } | 27 } |
29 | 28 |
30 class ChromeLauncherController; | 29 class ChromeLauncherController; |
31 class Profile; | 30 class Profile; |
32 class ShellWindowLauncherItemController; | 31 class AppWindowLauncherItemController; |
33 | 32 |
34 // ShellWindowLauncherController observes the app window registry and the | 33 // AppWindowLauncherController observes the app window registry and the |
35 // aura window manager. It handles adding and removing launcher items from | 34 // aura window manager. It handles adding and removing launcher items from |
36 // ChromeLauncherController. | 35 // ChromeLauncherController. |
37 // TODO(jamescook): Rename this to AppWindowLauncherController. | 36 class AppWindowLauncherController |
38 // http://crbug.com/344079 | |
39 class ShellWindowLauncherController | |
40 : public apps::AppWindowRegistry::Observer, | 37 : public apps::AppWindowRegistry::Observer, |
41 public aura::WindowObserver, | 38 public aura::WindowObserver, |
42 public aura::client::ActivationChangeObserver { | 39 public aura::client::ActivationChangeObserver { |
43 public: | 40 public: |
44 explicit ShellWindowLauncherController(ChromeLauncherController* owner); | 41 explicit AppWindowLauncherController(ChromeLauncherController* owner); |
45 virtual ~ShellWindowLauncherController(); | 42 virtual ~AppWindowLauncherController(); |
46 | 43 |
47 // Called by ChromeLauncherController when the active user changed and the | 44 // Called by ChromeLauncherController when the active user changed and the |
48 // items need to be updated. | 45 // items need to be updated. |
49 virtual void ActiveUserChanged(const std::string& user_email) {} | 46 virtual void ActiveUserChanged(const std::string& user_email) {} |
50 | 47 |
51 // An additional user identified by |Profile|, got added to the existing | 48 // An additional user identified by |Profile|, got added to the existing |
52 // session. | 49 // session. |
53 virtual void AdditionalUserAddedToSession(Profile* profile); | 50 virtual void AdditionalUserAddedToSession(Profile* profile); |
54 | 51 |
55 // Overridden from AppWindowRegistry::Observer: | 52 // Overridden from AppWindowRegistry::Observer: |
(...skipping 12 matching lines...) Expand all Loading... |
68 // Registers a app window with the shelf and this object. | 65 // Registers a app window with the shelf and this object. |
69 void RegisterApp(apps::AppWindow* app_window); | 66 void RegisterApp(apps::AppWindow* app_window); |
70 | 67 |
71 // Unregisters a app window with the shelf and this object. | 68 // Unregisters a app window with the shelf and this object. |
72 void UnregisterApp(aura::Window* window); | 69 void UnregisterApp(aura::Window* window); |
73 | 70 |
74 // Check if a given window is known to the launcher controller. | 71 // Check if a given window is known to the launcher controller. |
75 bool IsRegisteredApp(aura::Window* window); | 72 bool IsRegisteredApp(aura::Window* window); |
76 | 73 |
77 private: | 74 private: |
78 typedef std::map<std::string, ShellWindowLauncherItemController*> | 75 typedef std::map<std::string, AppWindowLauncherItemController*> |
79 AppControllerMap; | 76 AppControllerMap; |
80 typedef std::map<aura::Window*, std::string> WindowToAppShelfIdMap; | 77 typedef std::map<aura::Window*, std::string> WindowToAppShelfIdMap; |
81 | 78 |
82 ShellWindowLauncherItemController* ControllerForWindow(aura::Window* window); | 79 AppWindowLauncherItemController* ControllerForWindow(aura::Window* window); |
83 | 80 |
84 ChromeLauncherController* owner_; | 81 ChromeLauncherController* owner_; |
85 // A set of unowned AppWindowRegistry pointers for loaded users. | 82 // A set of unowned AppWindowRegistry pointers for loaded users. |
86 // Note that this will only be used with multiple users in the side by side | 83 // Note that this will only be used with multiple users in the side by side |
87 // mode. | 84 // mode. |
88 std::set<apps::AppWindowRegistry*> registry_; | 85 std::set<apps::AppWindowRegistry*> registry_; |
89 aura::client::ActivationClient* activation_client_; | 86 aura::client::ActivationClient* activation_client_; |
90 | 87 |
91 // Map of app launcher id to controller. | 88 // Map of app launcher id to controller. |
92 AppControllerMap app_controller_map_; | 89 AppControllerMap app_controller_map_; |
93 | 90 |
94 // Allows us to get from an aura::Window to the app shelf id. | 91 // Allows us to get from an aura::Window to the app shelf id. |
95 WindowToAppShelfIdMap window_to_app_shelf_id_map_; | 92 WindowToAppShelfIdMap window_to_app_shelf_id_map_; |
96 | 93 |
97 DISALLOW_COPY_AND_ASSIGN(ShellWindowLauncherController); | 94 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherController); |
98 }; | 95 }; |
99 | 96 |
100 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_ | 97 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |