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