| 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_MUS_LAYOUT_MANAGER_ADAPTER_H_ | 5 #ifndef ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ |
| 6 #define ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ | 6 #define ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // ensures WmLayoutManager::SetChildBounds() is called appropriately. | 27 // ensures WmLayoutManager::SetChildBounds() is called appropriately. |
| 28 class MusLayoutManagerAdapter : public ui::WindowObserver { | 28 class MusLayoutManagerAdapter : public ui::WindowObserver { |
| 29 public: | 29 public: |
| 30 MusLayoutManagerAdapter(ui::Window* window, | 30 MusLayoutManagerAdapter(ui::Window* window, |
| 31 std::unique_ptr<WmLayoutManager> layout_manager); | 31 std::unique_ptr<WmLayoutManager> layout_manager); |
| 32 ~MusLayoutManagerAdapter() override; | 32 ~MusLayoutManagerAdapter() override; |
| 33 | 33 |
| 34 WmLayoutManager* layout_manager() { return layout_manager_.get(); } | 34 WmLayoutManager* layout_manager() { return layout_manager_.get(); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // WindowObserver attached to child windows. A separate class is used to | |
| 38 // easily differentiate WindowObserver calls on the ui::Window associated | |
| 39 // with the MusLayoutManagerAdapter, vs children. | |
| 40 class ChildWindowObserver : public ui::WindowObserver { | |
| 41 public: | |
| 42 explicit ChildWindowObserver(MusLayoutManagerAdapter* adapter); | |
| 43 ~ChildWindowObserver() override; | |
| 44 | |
| 45 private: | |
| 46 // ui::WindowObserver: | |
| 47 void OnWindowVisibilityChanged(ui::Window* window) override; | |
| 48 | |
| 49 MusLayoutManagerAdapter* adapter_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(ChildWindowObserver); | |
| 52 }; | |
| 53 | |
| 54 // ui::WindowObserver: | 37 // ui::WindowObserver: |
| 55 void OnTreeChanging(const TreeChangeParams& params) override; | 38 void OnTreeChanging(const TreeChangeParams& params) override; |
| 56 void OnTreeChanged(const TreeChangeParams& params) override; | 39 void OnTreeChanged(const TreeChangeParams& params) override; |
| 57 void OnWindowBoundsChanged(ui::Window* window, | 40 void OnWindowBoundsChanged(ui::Window* window, |
| 58 const gfx::Rect& old_bounds, | 41 const gfx::Rect& old_bounds, |
| 59 const gfx::Rect& new_bounds) override; | 42 const gfx::Rect& new_bounds) override; |
| 43 void OnChildWindowVisibilityChanged(ui::Window* window, |
| 44 bool visible) override; |
| 60 | 45 |
| 61 ui::Window* window_; | 46 ui::Window* window_; |
| 62 ChildWindowObserver child_window_observer_; | |
| 63 std::unique_ptr<WmLayoutManager> layout_manager_; | 47 std::unique_ptr<WmLayoutManager> layout_manager_; |
| 64 | 48 |
| 65 DISALLOW_COPY_AND_ASSIGN(MusLayoutManagerAdapter); | 49 DISALLOW_COPY_AND_ASSIGN(MusLayoutManagerAdapter); |
| 66 }; | 50 }; |
| 67 | 51 |
| 68 } // namespace mus | 52 } // namespace mus |
| 69 } // namespace ash | 53 } // namespace ash |
| 70 | 54 |
| 71 #endif // ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ | 55 #endif // ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ |
| OLD | NEW |