Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / shell / window_watcher.h
blob50cd9e41dd40574bce566f7f28c71b0315826f21
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 ASH_SHELL_WINDOW_WATCHER_H_
6 #define ASH_SHELL_WINDOW_WATCHER_H_
8 #include <map>
10 #include "ash/shelf/shelf_item_types.h"
11 #include "base/compiler_specific.h"
12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/window_observer.h"
15 #include "ui/gfx/display_observer.h"
17 namespace aura {
18 class Window;
21 namespace ash {
22 namespace shell {
24 // TODO(sky): fix this class, its a bit broke with workspace2.
26 // WindowWatcher is responsible for listening for newly created windows and
27 // creating items on the Shelf for them.
28 class WindowWatcher : public aura::WindowObserver,
29 public gfx::DisplayObserver {
30 public:
31 WindowWatcher();
32 virtual ~WindowWatcher();
34 aura::Window* GetWindowByID(ash::ShelfID id);
36 // aura::WindowObserver overrides:
37 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
38 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE;
40 // gfx::DisplayObserver overrides:
41 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
42 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
43 virtual void OnDisplayMetricsChanged(const gfx::Display& display,
44 uint32_t metrics) OVERRIDE;
46 private:
47 class WorkspaceWindowWatcher;
49 typedef std::map<ash::ShelfID, aura::Window*> IDToWindow;
51 // Maps from window to the id we gave it.
52 IDToWindow id_to_window_;
54 scoped_ptr<WorkspaceWindowWatcher> workspace_window_watcher_;
56 DISALLOW_COPY_AND_ASSIGN(WindowWatcher);
59 } // namespace shell
60 } // namespace ash
62 #endif // ASH_SHELL_WINDOW_WATCHER_H_