OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_MUS_BRIDGE_WM_WINDOW_MUS_H_ | |
6 #define ASH_MUS_BRIDGE_WM_WINDOW_MUS_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/aura/wm_window_aura.h" | |
11 #include "base/macros.h" | |
12 | |
13 namespace aura { | |
14 class Window; | |
15 } | |
16 | |
17 namespace views { | |
18 class Widget; | |
19 } | |
20 | |
21 namespace ash { | |
22 namespace mus { | |
23 | |
24 // WmWindow implementation for mus. | |
25 // | |
26 // WmWindowMus is tied to the life of the underlying aura::Window (it is stored | |
27 // as an owned property). | |
28 class WmWindowMus : public WmWindowAura { | |
29 public: | |
30 explicit WmWindowMus(aura::Window* window); | |
31 // NOTE: this class is owned by the corresponding window. You shouldn't delete | |
32 // TODO(sky): friend deleter and make private. | |
33 ~WmWindowMus() override; | |
34 | |
35 // Returns a WmWindow for an aura::Window, creating if necessary. | |
36 static WmWindowMus* Get(aura::Window* window) { | |
37 return const_cast<WmWindowMus*>( | |
38 Get(const_cast<const aura::Window*>(window))); | |
39 } | |
40 static const WmWindowMus* Get(const aura::Window* window); | |
41 | |
42 static WmWindowMus* Get(views::Widget* widget); | |
43 | |
44 static WmWindowMus* AsWmWindowMus(WmWindow* window) { | |
45 return static_cast<WmWindowMus*>(window); | |
46 } | |
47 static const WmWindowMus* AsWmWindowMus(const WmWindow* window) { | |
48 return static_cast<const WmWindowMus*>(window); | |
49 } | |
50 | |
51 // Returns true if this window is considered a shell window container. | |
52 bool IsContainer() const; | |
53 | |
54 // WmWindow: | |
55 WmShell* GetShell() const override; | |
56 void CloseWidget() override; | |
57 void AddLimitedPreTargetHandler(ui::EventHandler* handler) override; | |
58 | |
59 private: | |
60 DISALLOW_COPY_AND_ASSIGN(WmWindowMus); | |
61 }; | |
62 | |
63 } // namespace mus | |
64 } // namespace ash | |
65 | |
66 #endif // ASH_MUS_BRIDGE_WM_WINDOW_MUS_H_ | |
OLD | NEW |