OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MASH_WM_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_MUS_LAYOUT_MANAGER_H_ |
6 #define MASH_WM_LAYOUT_MANAGER_H_ | 6 #define ASH_MUS_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/mus/public/cpp/window_observer.h" | 11 #include "components/mus/public/cpp/window_observer.h" |
12 | 12 |
13 namespace mash { | 13 namespace ash { |
14 namespace wm { | 14 namespace mus { |
15 | 15 |
16 // Base class for container layout managers. Derived classes override | 16 // Base class for container layout managers. Derived classes override |
17 // LayoutWindow() to perform layout and register properties to which | 17 // LayoutWindow() to perform layout and register properties to which |
18 // changes trigger layout. | 18 // changes trigger layout. |
19 // LayoutManagers observe both the bound container and all its children. | 19 // LayoutManagers observe both the bound container and all its children. |
20 // They must be attached prior to any windows being added to the | 20 // They must be attached prior to any windows being added to the |
21 // container. | 21 // container. |
22 class LayoutManager : public mus::WindowObserver { | 22 class LayoutManager : public ::mus::WindowObserver { |
23 public: | 23 public: |
24 ~LayoutManager() override; | 24 ~LayoutManager() override; |
25 | 25 |
26 protected: | 26 protected: |
27 explicit LayoutManager(mus::Window* owner); | 27 explicit LayoutManager(::mus::Window* owner); |
28 | 28 |
29 void Uninstall(); | 29 void Uninstall(); |
30 | 30 |
31 // Overridden from mus::WindowObserver: | 31 // Overridden from mus::WindowObserver: |
32 void OnTreeChanged( | 32 void OnTreeChanged( |
33 const mus::WindowObserver::TreeChangeParams& params) override; | 33 const ::mus::WindowObserver::TreeChangeParams& params) override; |
34 void OnWindowDestroying(mus::Window* window) override; | 34 void OnWindowDestroying(::mus::Window* window) override; |
35 void OnWindowBoundsChanged(mus::Window* window, | 35 void OnWindowBoundsChanged(::mus::Window* window, |
36 const gfx::Rect& old_bounds, | 36 const gfx::Rect& old_bounds, |
37 const gfx::Rect& new_bounds) override; | 37 const gfx::Rect& new_bounds) override; |
38 void OnWindowSharedPropertyChanged( | 38 void OnWindowSharedPropertyChanged( |
39 mus::Window* window, | 39 ::mus::Window* window, |
40 const std::string& name, | 40 const std::string& name, |
41 const std::vector<uint8_t>* old_data, | 41 const std::vector<uint8_t>* old_data, |
42 const std::vector<uint8_t>* new_data) override; | 42 const std::vector<uint8_t>* new_data) override; |
43 | 43 |
44 virtual void WindowAdded(mus::Window* window); | 44 virtual void WindowAdded(::mus::Window* window); |
45 virtual void WindowRemoved(mus::Window* window); | 45 virtual void WindowRemoved(::mus::Window* window); |
46 virtual void LayoutWindow(mus::Window* window) = 0; | 46 virtual void LayoutWindow(::mus::Window* window) = 0; |
47 | 47 |
48 // Add a property that triggers layout when changed. | 48 // Add a property that triggers layout when changed. |
49 void AddLayoutProperty(const std::string& property); | 49 void AddLayoutProperty(const std::string& property); |
50 | 50 |
51 mus::Window* owner() { return owner_; } | 51 ::mus::Window* owner() { return owner_; } |
52 | 52 |
53 private: | 53 private: |
54 mus::Window* owner_; | 54 ::mus::Window* owner_; |
55 | 55 |
56 std::set<std::string> layout_properties_; | 56 std::set<std::string> layout_properties_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(LayoutManager); | 58 DISALLOW_COPY_AND_ASSIGN(LayoutManager); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace wm | 61 } // namespace mus |
62 } // namespace mash | 62 } // namespace ash |
63 | 63 |
64 #endif // MASH_WM_LAYOUT_MANAGER_H_ | 64 #endif // ASH_MUS_LAYOUT_MANAGER_H_ |
OLD | NEW |