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 #include "mash/wm/window_manager_application.h" | 5 #include "mash/wm/window_manager_application.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 bool WindowManagerApplication::WindowIsContainer( | 59 bool WindowManagerApplication::WindowIsContainer( |
60 const mus::Window* window) const { | 60 const mus::Window* window) const { |
61 return window && window->parent() == root_; | 61 return window && window->parent() == root_; |
62 } | 62 } |
63 | 63 |
64 void WindowManagerApplication::AddAccelerators() { | 64 void WindowManagerApplication::AddAccelerators() { |
65 window_tree_host_->AddAccelerator( | 65 window_tree_host_->AddAccelerator( |
66 kWindowSwitchCmd, | 66 kWindowSwitchCmd, |
67 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_TAB, | 67 mus::CreateKeyMatcher(mus::mojom::KeyboardCode::TAB, |
68 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), | 68 mus::mojom::kEventFlagControlDown), |
69 base::Bind(&AssertTrue)); | 69 base::Bind(&AssertTrue)); |
70 } | 70 } |
71 | 71 |
72 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( | 72 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
73 AcceleratorRegistrarImpl* registrar) { | 73 AcceleratorRegistrarImpl* registrar) { |
74 accelerator_registrars_.erase(registrar); | 74 accelerator_registrars_.erase(registrar); |
75 } | 75 } |
76 | 76 |
77 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) { | 77 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) { |
78 app_ = app; | 78 app_ = app; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 void WindowManagerApplication::OnEmbed(mus::Window* root) { | 118 void WindowManagerApplication::OnEmbed(mus::Window* root) { |
119 root_ = root; | 119 root_ = root; |
120 root_->AddObserver(this); | 120 root_->AddObserver(this); |
121 CreateContainers(); | 121 CreateContainers(); |
122 background_layout_.reset(new BackgroundLayout( | 122 background_layout_.reset(new BackgroundLayout( |
123 GetWindowForContainer(mojom::CONTAINER_USER_BACKGROUND))); | 123 GetWindowForContainer(mojom::Container::USER_BACKGROUND))); |
124 shelf_layout_.reset( | 124 shelf_layout_.reset( |
125 new ShelfLayout(GetWindowForContainer(mojom::CONTAINER_USER_SHELF))); | 125 new ShelfLayout(GetWindowForContainer(mojom::Container::USER_SHELF))); |
126 | 126 |
127 mus::Window* window = GetWindowForContainer(mojom::CONTAINER_USER_WINDOWS); | 127 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS); |
128 window_layout_.reset( | 128 window_layout_.reset( |
129 new WindowLayout(GetWindowForContainer(mojom::CONTAINER_USER_WINDOWS))); | 129 new WindowLayout(GetWindowForContainer(mojom::Container::USER_WINDOWS))); |
130 window_tree_host_->AddActivationParent(window->id()); | 130 window_tree_host_->AddActivationParent(window->id()); |
131 window_tree_host_->SetTitle("Mash"); | 131 window_tree_host_->SetTitle("Mash"); |
132 | 132 |
133 AddAccelerators(); | 133 AddAccelerators(); |
134 | 134 |
135 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); | 135 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); |
136 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak")); | 136 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak")); |
137 window_manager_->Initialize(this); | 137 window_manager_->Initialize(this); |
138 | 138 |
139 for (auto& request : requests_) | 139 for (auto& request : requests_) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 DCHECK_EQ(window, root_); | 206 DCHECK_EQ(window, root_); |
207 root_->RemoveObserver(this); | 207 root_->RemoveObserver(this); |
208 // Delete the |window_manager_| here so that WindowManager doesn't have to | 208 // Delete the |window_manager_| here so that WindowManager doesn't have to |
209 // worry about the possibility of |root_| being null. | 209 // worry about the possibility of |root_| being null. |
210 window_manager_.reset(); | 210 window_manager_.reset(); |
211 root_ = nullptr; | 211 root_ = nullptr; |
212 } | 212 } |
213 | 213 |
214 void WindowManagerApplication::CreateContainers() { | 214 void WindowManagerApplication::CreateContainers() { |
215 for (uint16_t container = | 215 for (uint16_t container = |
216 static_cast<uint16_t>(mojom::CONTAINER_ALL_USER_BACKGROUND); | 216 static_cast<uint16_t>(mojom::Container::ALL_USER_BACKGROUND); |
217 container < static_cast<uint16_t>(mojom::CONTAINER_COUNT); ++container) { | 217 container < static_cast<uint16_t>(mojom::Container::COUNT); |
| 218 ++container) { |
218 mus::Window* window = root_->connection()->NewWindow(); | 219 mus::Window* window = root_->connection()->NewWindow(); |
219 DCHECK_EQ(mus::LoWord(window->id()), container) | 220 DCHECK_EQ(mus::LoWord(window->id()), container) |
220 << "Containers must be created before other windows!"; | 221 << "Containers must be created before other windows!"; |
221 window->SetBounds(root_->bounds()); | 222 window->SetBounds(root_->bounds()); |
222 window->SetVisible(true); | 223 window->SetVisible(true); |
223 root_->AddChild(window); | 224 root_->AddChild(window); |
224 } | 225 } |
225 } | 226 } |
226 | 227 |
227 } // namespace wm | 228 } // namespace wm |
228 } // namespace mash | 229 } // namespace mash |
OLD | NEW |