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