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