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_AURA_AURA_LAYOUT_MANAGER_ADAPTER_H_ | |
6 #define ASH_AURA_AURA_LAYOUT_MANAGER_ADAPTER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/macros.h" | |
12 #include "ui/aura/layout_manager.h" | |
13 | |
14 namespace ash { | |
15 | |
16 class WmLayoutManager; | |
17 | |
18 // AuraLayoutManagerAdapter is an aura::LayoutManager that calls to | |
19 // WmLayoutManager. Use it when you have a WmLayoutManager you want to use | |
20 // with an aura::Window. | |
21 class ASH_EXPORT AuraLayoutManagerAdapter : public aura::LayoutManager { | |
22 public: | |
23 AuraLayoutManagerAdapter(aura::Window* window, | |
24 std::unique_ptr<WmLayoutManager> wm_layout_manager); | |
25 ~AuraLayoutManagerAdapter() override; | |
26 | |
27 // Returns the AuraLayoutManagerAdapter installed on |window|, or null if | |
28 // an AuraLayoutManagerAdapter is not installed on |window|. | |
29 static AuraLayoutManagerAdapter* Get(aura::Window* window); | |
30 | |
31 WmLayoutManager* wm_layout_manager() { return wm_layout_manager_.get(); } | |
32 | |
33 // aura::LayoutManager: | |
34 void OnWindowResized() override; | |
35 void OnWindowAddedToLayout(aura::Window* child) override; | |
36 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | |
37 void OnWindowRemovedFromLayout(aura::Window* child) override; | |
38 void OnChildWindowVisibilityChanged(aura::Window* child, | |
39 bool visible) override; | |
40 void SetChildBounds(aura::Window* child, | |
41 const gfx::Rect& requested_bounds) override; | |
42 | |
43 private: | |
44 aura::Window* window_; | |
45 std::unique_ptr<WmLayoutManager> wm_layout_manager_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(AuraLayoutManagerAdapter); | |
48 }; | |
49 | |
50 } // namespace ash | |
51 | |
52 #endif // ASH_AURA_AURA_LAYOUT_MANAGER_ADAPTER_H_ | |
OLD | NEW |