[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 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. | ||||
4 | |||||
5 | #ifndef ASH_SHELL_WINDOW_WATCHER_H_ | ||||
6 | #define ASH_SHELL_WINDOW_WATCHER_H_ | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 7 | |
8 | #include <map> | ||||
9 | |||||
[email protected] | eec097142 | 2014-02-03 23:51:27 | [diff] [blame] | 10 | #include "ash/shelf/shelf_item_types.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 11 | #include "base/compiler_specific.h" |
12 | #include "base/logging.h" | ||||
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 13 | #include "base/memory/scoped_ptr.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 14 | #include "ui/aura/window_observer.h" |
[email protected] | 7a890e44 | 2013-01-23 00:48:20 | [diff] [blame] | 15 | #include "ui/gfx/display_observer.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 16 | |
17 | namespace aura { | ||||
18 | class Window; | ||||
19 | } | ||||
20 | |||||
21 | namespace ash { | ||||
22 | namespace shell { | ||||
23 | |||||
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 24 | // TODO(sky): fix this class, its a bit broke with workspace2. |
25 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 26 | // WindowWatcher is responsible for listening for newly created windows and |
[email protected] | 64936bf | 2013-11-14 19:48:36 | [diff] [blame] | 27 | // creating items on the Shelf for them. |
[email protected] | 7a890e44 | 2013-01-23 00:48:20 | [diff] [blame] | 28 | class WindowWatcher : public aura::WindowObserver, |
29 | public gfx::DisplayObserver { | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 30 | public: |
31 | WindowWatcher(); | ||||
dcheng | f596351 | 2014-10-28 01:14:13 | [diff] [blame] | 32 | ~WindowWatcher() override; |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 33 | |
[email protected] | eec097142 | 2014-02-03 23:51:27 | [diff] [blame] | 34 | aura::Window* GetWindowByID(ash::ShelfID id); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 35 | |
36 | // aura::WindowObserver overrides: | ||||
dcheng | f596351 | 2014-10-28 01:14:13 | [diff] [blame] | 37 | void OnWindowAdded(aura::Window* new_window) override; |
38 | void OnWillRemoveWindow(aura::Window* window) override; | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 39 | |
[email protected] | 7a890e44 | 2013-01-23 00:48:20 | [diff] [blame] | 40 | // gfx::DisplayObserver overrides: |
dcheng | f596351 | 2014-10-28 01:14:13 | [diff] [blame] | 41 | void OnDisplayAdded(const gfx::Display& new_display) override; |
42 | void OnDisplayRemoved(const gfx::Display& old_display) override; | ||||
43 | void OnDisplayMetricsChanged(const gfx::Display& display, | ||||
44 | uint32_t metrics) override; | ||||
[email protected] | 7a890e44 | 2013-01-23 00:48:20 | [diff] [blame] | 45 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 46 | private: |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 47 | class WorkspaceWindowWatcher; |
48 | |||||
[email protected] | eec097142 | 2014-02-03 23:51:27 | [diff] [blame] | 49 | typedef std::map<ash::ShelfID, aura::Window*> IDToWindow; |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 50 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 51 | // Maps from window to the id we gave it. |
52 | IDToWindow id_to_window_; | ||||
53 | |||||
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 54 | scoped_ptr<WorkspaceWindowWatcher> workspace_window_watcher_; |
55 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 56 | DISALLOW_COPY_AND_ASSIGN(WindowWatcher); |
57 | }; | ||||
58 | |||||
59 | } // namespace shell | ||||
60 | } // namespace ash | ||||
61 | |||||
62 | #endif // ASH_SHELL_WINDOW_WATCHER_H_ |