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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "components/mus/common/util.h" | 8 #include "components/mus/common/util.h" |
9 #include "components/mus/public/cpp/event_matcher.h" | 9 #include "components/mus/public/cpp/event_matcher.h" |
10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
11 #include "components/mus/public/cpp/window_tree_connection.h" | 11 #include "components/mus/public/cpp/window_tree_connection.h" |
12 #include "components/mus/public/cpp/window_tree_host_factory.h" | 12 #include "components/mus/public/cpp/window_tree_host_factory.h" |
13 #include "mash/wm/accelerator_registrar_impl.h" | 13 #include "mash/wm/accelerator_registrar_impl.h" |
14 #include "mash/wm/background_layout.h" | 14 #include "mash/wm/background_layout.h" |
| 15 #include "mash/wm/shadow_controller.h" |
15 #include "mash/wm/shelf_layout.h" | 16 #include "mash/wm/shelf_layout.h" |
16 #include "mash/wm/window_layout.h" | 17 #include "mash/wm/window_layout.h" |
17 #include "mash/wm/window_manager_impl.h" | 18 #include "mash/wm/window_manager_impl.h" |
18 #include "mojo/application/public/cpp/application_connection.h" | 19 #include "mojo/application/public/cpp/application_connection.h" |
19 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 20 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
20 #include "ui/mojo/init/ui_init.h" | 21 #include "ui/mojo/init/ui_init.h" |
21 #include "ui/views/mus/aura_init.h" | 22 #include "ui/views/mus/aura_init.h" |
22 #include "ui/views/mus/display_converter.h" | 23 #include "ui/views/mus/display_converter.h" |
23 | 24 |
24 namespace mash { | 25 namespace mash { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 124 |
124 AddAccelerators(); | 125 AddAccelerators(); |
125 | 126 |
126 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); | 127 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); |
127 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak")); | 128 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak")); |
128 window_manager_->Initialize(this); | 129 window_manager_->Initialize(this); |
129 | 130 |
130 for (auto request : requests_) | 131 for (auto request : requests_) |
131 window_manager_binding_.AddBinding(window_manager_.get(), request->Pass()); | 132 window_manager_binding_.AddBinding(window_manager_.get(), request->Pass()); |
132 requests_.clear(); | 133 requests_.clear(); |
| 134 |
| 135 shadow_controller_.reset(new ShadowController(root->connection())); |
133 } | 136 } |
134 | 137 |
135 void WindowManagerApplication::OnConnectionLost( | 138 void WindowManagerApplication::OnConnectionLost( |
136 mus::WindowTreeConnection* connection) { | 139 mus::WindowTreeConnection* connection) { |
137 // TODO(sky): shutdown. | 140 // TODO(sky): shutdown. |
138 NOTIMPLEMENTED(); | 141 NOTIMPLEMENTED(); |
| 142 shadow_controller_.reset(); |
139 } | 143 } |
140 | 144 |
141 void WindowManagerApplication::Create( | 145 void WindowManagerApplication::Create( |
142 mojo::ApplicationConnection* connection, | 146 mojo::ApplicationConnection* connection, |
143 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { | 147 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { |
144 static int accelerator_registrar_count = 0; | 148 static int accelerator_registrar_count = 0; |
145 if (accelerator_registrar_count == std::numeric_limits<int>::max()) { | 149 if (accelerator_registrar_count == std::numeric_limits<int>::max()) { |
146 // Restart from zero if we have reached the limit. It is technically | 150 // Restart from zero if we have reached the limit. It is technically |
147 // possible to end up with multiple active registrars with the same | 151 // possible to end up with multiple active registrars with the same |
148 // namespace, but it is highly unlikely. In the event that multiple | 152 // namespace, but it is highly unlikely. In the event that multiple |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 DCHECK_EQ(mus::LoWord(window->id()), container) | 188 DCHECK_EQ(mus::LoWord(window->id()), container) |
185 << "Containers must be created before other windows!"; | 189 << "Containers must be created before other windows!"; |
186 window->SetBounds(root_->bounds()); | 190 window->SetBounds(root_->bounds()); |
187 window->SetVisible(true); | 191 window->SetVisible(true); |
188 root_->AddChild(window); | 192 root_->AddChild(window); |
189 } | 193 } |
190 } | 194 } |
191 | 195 |
192 } // namespace wm | 196 } // namespace wm |
193 } // namespace mash | 197 } // namespace mash |
OLD | NEW |