Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: ash/mus/bridge/mus_layout_manager_adapter.h

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/mus/public/cpp/window_observer.h" 11 #include "components/mus/public/cpp/window_observer.h"
12 12
13 namespace ash { 13 namespace ash {
14 namespace wm {
15 class WmLayoutManager; 14 class WmLayoutManager;
16 }
17 15
18 namespace mus { 16 namespace mus {
19 17
20 // Used to associate a mus::Window with an wm::WmLayoutManager. This 18 // Used to associate a mus::Window with an WmLayoutManager. This
21 // attaches an observer to the mus::Window and calls the appropriate methods on 19 // attaches an observer to the mus::Window and calls the appropriate methods on
22 // the WmLayoutManager at the appropriate time. 20 // the WmLayoutManager at the appropriate time.
23 // 21 //
24 // NOTE: WmLayoutManager provides the function SetChildBounds(). This is 22 // NOTE: WmLayoutManager provides the function SetChildBounds(). This is
25 // expected to be called to change the bounds of the Window. For aura this 23 // expected to be called to change the bounds of the Window. For aura this
26 // function is called by way of aura exposing a hook (aura::LayoutManager). Mus 24 // function is called by way of aura exposing a hook (aura::LayoutManager). Mus
27 // has no such hook. To ensure SetChildBounds() is called correctly all bounds 25 // has no such hook. To ensure SetChildBounds() is called correctly all bounds
28 // changes to mus::Windows must be routed through WmWindowMus. WmWindowMus 26 // changes to mus::Windows must be routed through WmWindowMus. WmWindowMus
29 // ensures WmLayoutManager::SetChildBounds() is called appropriately. 27 // ensures WmLayoutManager::SetChildBounds() is called appropriately.
30 class MusLayoutManagerAdapter : public ::mus::WindowObserver { 28 class MusLayoutManagerAdapter : public ::mus::WindowObserver {
31 public: 29 public:
32 MusLayoutManagerAdapter(::mus::Window* window, 30 MusLayoutManagerAdapter(::mus::Window* window,
33 std::unique_ptr<wm::WmLayoutManager> layout_manager); 31 std::unique_ptr<WmLayoutManager> layout_manager);
34 ~MusLayoutManagerAdapter() override; 32 ~MusLayoutManagerAdapter() override;
35 33
36 wm::WmLayoutManager* layout_manager() { return layout_manager_.get(); } 34 WmLayoutManager* layout_manager() { return layout_manager_.get(); }
37 35
38 private: 36 private:
39 // WindowObserver attached to child windows. A separate class is used to 37 // WindowObserver attached to child windows. A separate class is used to
40 // easily differentiate WindowObserver calls on the mus::Window associated 38 // easily differentiate WindowObserver calls on the mus::Window associated
41 // with the MusLayoutManagerAdapter, vs children. 39 // with the MusLayoutManagerAdapter, vs children.
42 class ChildWindowObserver : public ::mus::WindowObserver { 40 class ChildWindowObserver : public ::mus::WindowObserver {
43 public: 41 public:
44 explicit ChildWindowObserver(MusLayoutManagerAdapter* adapter); 42 explicit ChildWindowObserver(MusLayoutManagerAdapter* adapter);
45 ~ChildWindowObserver() override; 43 ~ChildWindowObserver() override;
46 44
47 private: 45 private:
48 // mus::WindowObserver: 46 // mus::WindowObserver:
49 void OnWindowVisibilityChanged(::mus::Window* window) override; 47 void OnWindowVisibilityChanged(::mus::Window* window) override;
50 48
51 MusLayoutManagerAdapter* adapter_; 49 MusLayoutManagerAdapter* adapter_;
52 50
53 DISALLOW_COPY_AND_ASSIGN(ChildWindowObserver); 51 DISALLOW_COPY_AND_ASSIGN(ChildWindowObserver);
54 }; 52 };
55 53
56 // mus::WindowObserver: 54 // mus::WindowObserver:
57 void OnTreeChanging(const TreeChangeParams& params) override; 55 void OnTreeChanging(const TreeChangeParams& params) override;
58 void OnTreeChanged(const TreeChangeParams& params) override; 56 void OnTreeChanged(const TreeChangeParams& params) override;
59 void OnWindowBoundsChanged(::mus::Window* window, 57 void OnWindowBoundsChanged(::mus::Window* window,
60 const gfx::Rect& old_bounds, 58 const gfx::Rect& old_bounds,
61 const gfx::Rect& new_bounds) override; 59 const gfx::Rect& new_bounds) override;
62 60
63 ::mus::Window* window_; 61 ::mus::Window* window_;
64 ChildWindowObserver child_window_observer_; 62 ChildWindowObserver child_window_observer_;
65 std::unique_ptr<wm::WmLayoutManager> layout_manager_; 63 std::unique_ptr<WmLayoutManager> layout_manager_;
66 64
67 DISALLOW_COPY_AND_ASSIGN(MusLayoutManagerAdapter); 65 DISALLOW_COPY_AND_ASSIGN(MusLayoutManagerAdapter);
68 }; 66 };
69 67
70 } // namespace mus 68 } // namespace mus
71 } // namespace ash 69 } // namespace ash
72 70
73 #endif // ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_ 71 #endif // ASH_MUS_BRIDGE_MUS_LAYOUT_MANAGER_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698