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_shell_mus.h" | 17 #include "ash/mus/bridge/wm_shell_mus.h" |
19 #include "ash/mus/bridge/wm_window_mus.h" | 18 #include "ash/mus/bridge/wm_window_mus.h" |
20 #include "ash/mus/move_event_handler.h" | 19 #include "ash/mus/move_event_handler.h" |
21 #include "ash/mus/non_client_frame_controller.h" | 20 #include "ash/mus/non_client_frame_controller.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 132 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
134 frame_decoration_values->max_title_bar_button_width = | 133 frame_decoration_values->max_title_bar_button_width = |
135 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 134 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
136 window_manager_client_->SetFrameDecorationValues( | 135 window_manager_client_->SetFrameDecorationValues( |
137 std::move(frame_decoration_values)); | 136 std::move(frame_decoration_values)); |
138 | 137 |
139 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), | 138 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), |
140 this, pointer_watcher_event_router_.get())); | 139 this, pointer_watcher_event_router_.get())); |
141 shell_->Initialize(blocking_pool); | 140 shell_->Initialize(blocking_pool); |
142 lookup_.reset(new WmLookupMus); | 141 lookup_.reset(new WmLookupMus); |
| 142 |
| 143 // TODO: this should be called when logged in. See http://crbug.com/654606. |
| 144 shell_->CreateShelf(); |
143 } | 145 } |
144 | 146 |
145 aura::client::ActivationClient* WindowManager::activation_client() { | 147 aura::client::ActivationClient* WindowManager::activation_client() { |
146 return focus_controller_.get(); | 148 return focus_controller_.get(); |
147 } | 149 } |
148 | 150 |
149 aura::Window* WindowManager::NewTopLevelWindow( | 151 aura::Window* WindowManager::NewTopLevelWindow( |
150 ui::mojom::WindowType window_type, | 152 ui::mojom::WindowType window_type, |
151 std::map<std::string, std::vector<uint8_t>>* properties) { | 153 std::map<std::string, std::vector<uint8_t>>* properties) { |
152 RootWindowController* root_window_controller = | 154 RootWindowController* root_window_controller = |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 aura::client::SetScreenPositionClient(window_tree_host->window(), | 221 aura::client::SetScreenPositionClient(window_tree_host->window(), |
220 screen_position_controller_.get()); | 222 screen_position_controller_.get()); |
221 | 223 |
222 std::unique_ptr<RootWindowController> root_window_controller_ptr( | 224 std::unique_ptr<RootWindowController> root_window_controller_ptr( |
223 new RootWindowController(this, std::move(window_tree_host), display, | 225 new RootWindowController(this, std::move(window_tree_host), display, |
224 root_window_type)); | 226 root_window_type)); |
225 RootWindowController* root_window_controller = | 227 RootWindowController* root_window_controller = |
226 root_window_controller_ptr.get(); | 228 root_window_controller_ptr.get(); |
227 root_window_controllers_.insert(std::move(root_window_controller_ptr)); | 229 root_window_controllers_.insert(std::move(root_window_controller_ptr)); |
228 | 230 |
229 // Create a shelf if a user is already logged in. | 231 // TODO: this should be called when logged in. See http://crbug.com/654606. |
230 if (shell_->session_controller()->NumberOfLoggedInUsers()) | 232 root_window_controller->ash_root_window_controller() |
231 root_window_controller->ash_root_window_controller()->CreateShelf(); | 233 ->CreateShelf(); |
232 | 234 |
233 for (auto& observer : observers_) | 235 for (auto& observer : observers_) |
234 observer.OnRootWindowControllerAdded(root_window_controller); | 236 observer.OnRootWindowControllerAdded(root_window_controller); |
235 | 237 |
236 for (auto& observer : *screen_->display_list().observers()) | 238 for (auto& observer : *screen_->display_list().observers()) |
237 observer.OnDisplayAdded(root_window_controller->display()); | 239 observer.OnDisplayAdded(root_window_controller->display()); |
238 | 240 |
239 return root_window_controller; | 241 return root_window_controller; |
240 } | 242 } |
241 | 243 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 512 |
511 void WindowManager::OnWindowInitialized(aura::Window* window) { | 513 void WindowManager::OnWindowInitialized(aura::Window* window) { |
512 // This ensures WmWindowAura won't be called before WmWindowMus. This is | 514 // This ensures WmWindowAura won't be called before WmWindowMus. This is |
513 // important as if WmWindowAura::Get() is called first, then WmWindowAura | 515 // important as if WmWindowAura::Get() is called first, then WmWindowAura |
514 // would be created, not WmWindowMus. | 516 // would be created, not WmWindowMus. |
515 WmWindowMus::Get(window); | 517 WmWindowMus::Get(window); |
516 } | 518 } |
517 | 519 |
518 } // namespace mus | 520 } // namespace mus |
519 } // namespace ash | 521 } // namespace ash |
OLD | NEW |