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 "ash/mus/window_manager.h" | 5 #include "ash/mus/window_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "ash/common/session/session_controller.h" | |
12 #include "ash/common/wm/container_finder.h" | 11 #include "ash/common/wm/container_finder.h" |
13 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
14 #include "ash/display/screen_position_controller.h" | 13 #include "ash/display/screen_position_controller.h" |
15 #include "ash/mus/accelerators/accelerator_handler.h" | 14 #include "ash/mus/accelerators/accelerator_handler.h" |
16 #include "ash/mus/accelerators/accelerator_ids.h" | 15 #include "ash/mus/accelerators/accelerator_ids.h" |
17 #include "ash/mus/bridge/wm_lookup_mus.h" | 16 #include "ash/mus/bridge/wm_lookup_mus.h" |
18 #include "ash/mus/bridge/wm_root_window_controller_mus.h" | 17 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
19 #include "ash/mus/bridge/wm_shell_mus.h" | 18 #include "ash/mus/bridge/wm_shell_mus.h" |
20 #include "ash/mus/bridge/wm_window_mus.h" | 19 #include "ash/mus/bridge/wm_window_mus.h" |
21 #include "ash/mus/move_event_handler.h" | 20 #include "ash/mus/move_event_handler.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 127 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
129 frame_decoration_values->max_title_bar_button_width = | 128 frame_decoration_values->max_title_bar_button_width = |
130 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 129 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
131 window_manager_client_->SetFrameDecorationValues( | 130 window_manager_client_->SetFrameDecorationValues( |
132 std::move(frame_decoration_values)); | 131 std::move(frame_decoration_values)); |
133 | 132 |
134 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), | 133 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), |
135 this, pointer_watcher_event_router_.get())); | 134 this, pointer_watcher_event_router_.get())); |
136 shell_->Initialize(blocking_pool); | 135 shell_->Initialize(blocking_pool); |
137 lookup_.reset(new WmLookupMus); | 136 lookup_.reset(new WmLookupMus); |
| 137 |
| 138 // TODO: this should be called when logged in. See http://crbug.com/654606. |
| 139 shell_->CreateShelf(); |
138 } | 140 } |
139 | 141 |
140 aura::client::ActivationClient* WindowManager::activation_client() { | 142 aura::client::ActivationClient* WindowManager::activation_client() { |
141 return focus_controller_.get(); | 143 return focus_controller_.get(); |
142 } | 144 } |
143 | 145 |
144 aura::Window* WindowManager::NewTopLevelWindow( | 146 aura::Window* WindowManager::NewTopLevelWindow( |
145 ui::mojom::WindowType window_type, | 147 ui::mojom::WindowType window_type, |
146 std::map<std::string, std::vector<uint8_t>>* properties) { | 148 std::map<std::string, std::vector<uint8_t>>* properties) { |
147 RootWindowController* root_window_controller = | 149 RootWindowController* root_window_controller = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 aura::client::SetEventClient(window_tree_host->window(), event_client_.get()); | 215 aura::client::SetEventClient(window_tree_host->window(), event_client_.get()); |
214 aura::client::SetScreenPositionClient(window_tree_host->window(), | 216 aura::client::SetScreenPositionClient(window_tree_host->window(), |
215 screen_position_controller_.get()); | 217 screen_position_controller_.get()); |
216 | 218 |
217 std::unique_ptr<RootWindowController> root_window_controller_ptr( | 219 std::unique_ptr<RootWindowController> root_window_controller_ptr( |
218 new RootWindowController(this, std::move(window_tree_host), display)); | 220 new RootWindowController(this, std::move(window_tree_host), display)); |
219 RootWindowController* root_window_controller = | 221 RootWindowController* root_window_controller = |
220 root_window_controller_ptr.get(); | 222 root_window_controller_ptr.get(); |
221 root_window_controllers_.insert(std::move(root_window_controller_ptr)); | 223 root_window_controllers_.insert(std::move(root_window_controller_ptr)); |
222 | 224 |
223 // Create a shelf if a user is already logged in. | 225 // TODO: this should be called when logged in. See http://crbug.com/654606. |
224 if (shell_->session_controller()->NumberOfLoggedInUsers()) | 226 root_window_controller->wm_root_window_controller()->CreateShelf(); |
225 root_window_controller->wm_root_window_controller()->CreateShelf(); | |
226 | 227 |
227 for (auto& observer : observers_) | 228 for (auto& observer : observers_) |
228 observer.OnRootWindowControllerAdded(root_window_controller); | 229 observer.OnRootWindowControllerAdded(root_window_controller); |
229 | 230 |
230 for (auto& observer : *screen_->display_list().observers()) | 231 for (auto& observer : *screen_->display_list().observers()) |
231 observer.OnDisplayAdded(root_window_controller->display()); | 232 observer.OnDisplayAdded(root_window_controller->display()); |
232 | 233 |
233 return root_window_controller; | 234 return root_window_controller; |
234 } | 235 } |
235 | 236 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 501 |
501 void WindowManager::OnWindowInitialized(aura::Window* window) { | 502 void WindowManager::OnWindowInitialized(aura::Window* window) { |
502 // This ensures WmWindowAura won't be called before WmWindowMus. This is | 503 // This ensures WmWindowAura won't be called before WmWindowMus. This is |
503 // important as if WmWindowAura::Get() is called first, then WmWindowAura | 504 // important as if WmWindowAura::Get() is called first, then WmWindowAura |
504 // would be created, not WmWindowMus. | 505 // would be created, not WmWindowMus. |
505 WmWindowMus::Get(window); | 506 WmWindowMus::Get(window); |
506 } | 507 } |
507 | 508 |
508 } // namespace mus | 509 } // namespace mus |
509 } // namespace ash | 510 } // namespace ash |
OLD | NEW |