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

Side by Side Diff: ash/mus/layout_manager.cc

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment 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
« no previous file with comments | « ash/mus/layout_manager.h ('k') | ash/mus/layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "mash/wm/layout_manager.h" 5 #include "ash/mus/layout_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window.h" 10 #include "components/mus/public/cpp/window.h"
11 #include "components/mus/public/cpp/window_property.h" 11 #include "components/mus/public/cpp/window_property.h"
12 12
13 namespace mash { 13 namespace ash {
14 namespace wm { 14 namespace mus {
15 15
16 LayoutManager::~LayoutManager() { 16 LayoutManager::~LayoutManager() {
17 Uninstall(); 17 Uninstall();
18 } 18 }
19 19
20 LayoutManager::LayoutManager(mus::Window* owner) : owner_(owner) { 20 LayoutManager::LayoutManager(::mus::Window* owner) : owner_(owner) {
21 owner_->AddObserver(this); 21 owner_->AddObserver(this);
22 DCHECK(owner->children().empty()); 22 DCHECK(owner->children().empty());
23 } 23 }
24 24
25 void LayoutManager::Uninstall() { 25 void LayoutManager::Uninstall() {
26 if (!owner_) 26 if (!owner_)
27 return; 27 return;
28 owner_->RemoveObserver(this); 28 owner_->RemoveObserver(this);
29 for (auto child : owner_->children()) 29 for (auto child : owner_->children())
30 child->RemoveObserver(this); 30 child->RemoveObserver(this);
31 owner_ = nullptr; 31 owner_ = nullptr;
32 } 32 }
33 33
34 void LayoutManager::OnTreeChanged( 34 void LayoutManager::OnTreeChanged(
35 const mus::WindowObserver::TreeChangeParams& params) { 35 const ::mus::WindowObserver::TreeChangeParams& params) {
36 DCHECK(params.target); 36 DCHECK(params.target);
37 if (params.new_parent == owner_) { 37 if (params.new_parent == owner_) {
38 // params.target was added to the layout. 38 // params.target was added to the layout.
39 WindowAdded(params.target); 39 WindowAdded(params.target);
40 params.target->AddObserver(this); 40 params.target->AddObserver(this);
41 LayoutWindow(params.target); 41 LayoutWindow(params.target);
42 } else if (params.old_parent == owner_) { 42 } else if (params.old_parent == owner_) {
43 // params.target was removed from the layout. 43 // params.target was removed from the layout.
44 params.target->RemoveObserver(this); 44 params.target->RemoveObserver(this);
45 WindowRemoved(params.target); 45 WindowRemoved(params.target);
46 } 46 }
47 } 47 }
48 48
49 void LayoutManager::OnWindowDestroying(mus::Window* window) { 49 void LayoutManager::OnWindowDestroying(::mus::Window* window) {
50 if (owner_ == window) 50 if (owner_ == window)
51 Uninstall(); 51 Uninstall();
52 } 52 }
53 53
54 void LayoutManager::OnWindowBoundsChanged(mus::Window* window, 54 void LayoutManager::OnWindowBoundsChanged(::mus::Window* window,
55 const gfx::Rect& old_bounds, 55 const gfx::Rect& old_bounds,
56 const gfx::Rect& new_bounds) { 56 const gfx::Rect& new_bounds) {
57 if (window != owner_) 57 if (window != owner_)
58 return; 58 return;
59 59
60 // Changes to the container's bounds require all windows to be laid out. 60 // Changes to the container's bounds require all windows to be laid out.
61 for (auto child : window->children()) 61 for (auto child : window->children())
62 LayoutWindow(child); 62 LayoutWindow(child);
63 } 63 }
64 64
65 void LayoutManager::OnWindowSharedPropertyChanged( 65 void LayoutManager::OnWindowSharedPropertyChanged(
66 mus::Window* window, 66 ::mus::Window* window,
67 const std::string& name, 67 const std::string& name,
68 const std::vector<uint8_t>* old_data, 68 const std::vector<uint8_t>* old_data,
69 const std::vector<uint8_t>* new_data) { 69 const std::vector<uint8_t>* new_data) {
70 if (window == owner_) 70 if (window == owner_)
71 return; 71 return;
72 72
73 // Changes to the following properties require the window to be laid out. 73 // Changes to the following properties require the window to be laid out.
74 if (layout_properties_.count(name) > 0) 74 if (layout_properties_.count(name) > 0)
75 LayoutWindow(window); 75 LayoutWindow(window);
76 } 76 }
77 77
78 void LayoutManager::WindowAdded(mus::Window* window) {} 78 void LayoutManager::WindowAdded(::mus::Window* window) {}
79 void LayoutManager::WindowRemoved(mus::Window* window) {} 79 void LayoutManager::WindowRemoved(::mus::Window* window) {}
80 80
81 void LayoutManager::AddLayoutProperty(const std::string& name) { 81 void LayoutManager::AddLayoutProperty(const std::string& name) {
82 layout_properties_.insert(name); 82 layout_properties_.insert(name);
83 } 83 }
84 84
85 } // namespace wm 85 } // namespace mus
86 } // namespace mash 86 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/layout_manager.h ('k') | ash/mus/layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698