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