NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / ash / launcher / shell_window_launcher_controller.h
blob5b9dacab932238516025e613727f1e421bd6bad3
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_
8 #include <list>
9 #include <map>
10 #include <string>
12 #include "apps/app_window_registry.h"
13 #include "ui/aura/client/activation_change_observer.h"
14 #include "ui/aura/window_observer.h"
16 namespace apps {
17 class AppWindow;
20 namespace aura {
22 class Window;
24 namespace client {
25 class ActivationClient;
30 class ChromeLauncherController;
31 class Profile;
32 class ShellWindowLauncherItemController;
34 // ShellWindowLauncherController observes the app window registry and the
35 // aura window manager. It handles adding and removing launcher items from
36 // ChromeLauncherController.
37 // TODO(jamescook): Rename this to AppWindowLauncherController.
38 // http://crbug.com/344079
39 class ShellWindowLauncherController
40 : public apps::AppWindowRegistry::Observer,
41 public aura::WindowObserver,
42 public aura::client::ActivationChangeObserver {
43 public:
44 explicit ShellWindowLauncherController(ChromeLauncherController* owner);
45 virtual ~ShellWindowLauncherController();
47 // Called by ChromeLauncherController when the active user changed and the
48 // items need to be updated.
49 virtual void ActiveUserChanged(const std::string& user_email) {}
51 // An additional user identified by |Profile|, got added to the existing
52 // session.
53 virtual void AdditionalUserAddedToSession(Profile* profile);
55 // Overridden from AppWindowRegistry::Observer:
56 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE;
57 virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE;
58 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE;
60 // Overriden from aura::WindowObserver:
61 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
63 // Overriden from client::ActivationChangeObserver:
64 virtual void OnWindowActivated(aura::Window* gained_active,
65 aura::Window* lost_active) OVERRIDE;
67 protected:
68 // Registers a app window with the shelf and this object.
69 void RegisterApp(apps::AppWindow* app_window);
71 // Unregisters a app window with the shelf and this object.
72 void UnregisterApp(aura::Window* window);
74 // Check if a given window is known to the launcher controller.
75 bool IsRegisteredApp(aura::Window* window);
77 private:
78 typedef std::map<std::string, ShellWindowLauncherItemController*>
79 AppControllerMap;
80 typedef std::map<aura::Window*, std::string> WindowToAppShelfIdMap;
82 ShellWindowLauncherItemController* ControllerForWindow(aura::Window* window);
84 ChromeLauncherController* owner_;
85 // 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
87 // mode.
88 std::set<apps::AppWindowRegistry*> registry_;
89 aura::client::ActivationClient* activation_client_;
91 // Map of app launcher id to controller.
92 AppControllerMap app_controller_map_;
94 // Allows us to get from an aura::Window to the app shelf id.
95 WindowToAppShelfIdMap window_to_app_shelf_id_map_;
97 DISALLOW_COPY_AND_ASSIGN(ShellWindowLauncherController);
100 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_CONTROLLER_H_