blob: 001914d56f40d50dafe1eb8714cb65e05217cbfc [file] [log] [blame]
[email protected]262f8bd2012-03-23 19:30:271// 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]262f8bd2012-03-23 19:30:277
8#include <map>
9
[email protected]eec0971422014-02-03 23:51:2710#include "ash/shelf/shelf_item_types.h"
[email protected]262f8bd2012-03-23 19:30:2711#include "base/compiler_specific.h"
12#include "base/logging.h"
[email protected]95058572012-08-20 14:57:2913#include "base/memory/scoped_ptr.h"
[email protected]262f8bd2012-03-23 19:30:2714#include "ui/aura/window_observer.h"
[email protected]7a890e442013-01-23 00:48:2015#include "ui/gfx/display_observer.h"
[email protected]262f8bd2012-03-23 19:30:2716
17namespace aura {
18class Window;
19}
20
21namespace ash {
22namespace shell {
23
[email protected]95058572012-08-20 14:57:2924// TODO(sky): fix this class, its a bit broke with workspace2.
25
[email protected]262f8bd2012-03-23 19:30:2726// WindowWatcher is responsible for listening for newly created windows and
[email protected]64936bf2013-11-14 19:48:3627// creating items on the Shelf for them.
[email protected]7a890e442013-01-23 00:48:2028class WindowWatcher : public aura::WindowObserver,
29 public gfx::DisplayObserver {
[email protected]262f8bd2012-03-23 19:30:2730 public:
31 WindowWatcher();
dchengf5963512014-10-28 01:14:1332 ~WindowWatcher() override;
[email protected]262f8bd2012-03-23 19:30:2733
[email protected]eec0971422014-02-03 23:51:2734 aura::Window* GetWindowByID(ash::ShelfID id);
[email protected]262f8bd2012-03-23 19:30:2735
36 // aura::WindowObserver overrides:
dchengf5963512014-10-28 01:14:1337 void OnWindowAdded(aura::Window* new_window) override;
38 void OnWillRemoveWindow(aura::Window* window) override;
[email protected]262f8bd2012-03-23 19:30:2739
[email protected]7a890e442013-01-23 00:48:2040 // gfx::DisplayObserver overrides:
dchengf5963512014-10-28 01:14:1341 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]7a890e442013-01-23 00:48:2045
[email protected]262f8bd2012-03-23 19:30:2746 private:
[email protected]95058572012-08-20 14:57:2947 class WorkspaceWindowWatcher;
48
[email protected]eec0971422014-02-03 23:51:2749 typedef std::map<ash::ShelfID, aura::Window*> IDToWindow;
[email protected]262f8bd2012-03-23 19:30:2750
[email protected]262f8bd2012-03-23 19:30:2751 // Maps from window to the id we gave it.
52 IDToWindow id_to_window_;
53
[email protected]95058572012-08-20 14:57:2954 scoped_ptr<WorkspaceWindowWatcher> workspace_window_watcher_;
55
[email protected]262f8bd2012-03-23 19:30:2756 DISALLOW_COPY_AND_ASSIGN(WindowWatcher);
57};
58
59} // namespace shell
60} // namespace ash
61
62#endif // ASH_SHELL_WINDOW_WATCHER_H_